@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
@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