Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Vanilla CSS, JS

Dan• 820

@Gitit2meBaby

Desktop design screenshot for the Space tourism multi-page website coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


I have an issue with the Tech page, 50% of the time it works fine, For others I get a return of null and am not fetching the JSON data correctly. not sure why... I think I will watch the tutorial now to get a better handle on the correct methods to get this site looking and functioning properly.

Community feedback

@alexander-hergert

Posted

Hi Dan, good job on the project. To answer your questions:

I do not see issues with fetching. That seems fine for me. The two issue you name if understand correctly is that switching between the objects in the technology page is not working correctly. It seems your event triggers when you click the h3 or the parent div element. My solution would be to lift up the data-set to the parent div like so:

In your technology.html file at line 80:

<div class="technology-toggles-container ">
    <div data-technology="Launch vehicle" class="technology-toggle-btn technology-toggle- 
      active">
        <h3 id="tech1">1</h3>
    </div>
    <div data-technology="Spaceport" class="technology-toggle-btn">
         <h3 id="tech2">2</h3>
    </div>
    <div data-technology="Space capsule" class="technology-toggle-btn">
         <h3 id="tech3">3</h3>
    </div>
</div>

Otherwise the div element will not have the infos when you click on it and the page is not changing.

Another issue you have is the:

script.js:53 Uncaught (in promise) TypeError: Cannot set properties of null (setting 'textContent')
    at updateDestination (script.js:53:42)
    at script.js:20:9

This issue happens because your single script.js file is always trying to read elements which are not always in the document. If you switch the pages then some of the elements are always missing.

You can help yourself if you wrap your functions into a try catch block so that the code does not break if you try to use properties of null or what I would advise is to use a different structure in first place.

You could create a src folder and divide your script file into a script file for each page instead and link the correct file in the head. That should also avoid the error since the elements wich are missing will not be tried to selected or used.

I hope this helps you a bit Dan. My advice is to make a different structure for your files in the next project, since its not common to have everything in one file. Practice this please :D Also make more use of Git and structure your project in small steps and commit them. This helps to understand how you developed your project and helps your to jump back to a working state in case the projects breaks.

Best regards Alex

Marked as helpful

0

Dan• 820

@Gitit2meBaby

Posted

Hi Alex, Thank you so much mate for a thorough inspection and a really helpful reply. I really appreciate the time you put into pointing me in the right direction, I see the issues and will enjoy rectifying them this evening. I will do my best to update my repo more often, I guess because I have been doing the projects in one session I hadn't felt the need, but you bring up a valid point and as the projects get more difficult I am sure this will be valuable information. Thanks again Dan

1
Carlos Villarta• 260

@caloyv

Posted

Hi, I think I found the issue to your problem regarding to the tech page. Your data is not updating when you press the button because almost the whole button is covered by the parent <div class="technology-toggle-btn"> but the <h3> tag is so small. Your button changes state when you press the parent div but the data wont update if you miss the <h3> tag. Open the dev tools, enable the select element and hover to the buttons to verify it. Hope this helps :).

0

Dan• 820

@Gitit2meBaby

Posted

Hi Carlos, Thanks mate I see the issue now. I appreciate you taking the time to sort this one out for me. Cheers Dan

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord