
Design comparison
Solution retrospective
Hi here is my solution for Planets-fact-site. I used HTML, CSS, JS.
What challenges did you encounter, and how did you overcome them?It was to set the different element and keep them steady for the different planets.
And to display the image for the planet following the size of the planet and the size of the window user :
fetch(url) // extract svg
.then(response => response.text())
.then(svgCode => {
document.querySelector('.container-svg').innerHTML = svgCode;
if(window.innerWidth >= 704 && window.innerWidth < 1440){
document.querySelector('.container-svg svg').style.width =
`${Number( window.getComputedStyle(document.querySelector('.container-svg svg') ).width.split('px')[0] ) * 1.6}px`;
document.querySelector('.container-svg svg').style.height =
`${Number( window.getComputedStyle(document.querySelector('.container-svg svg') ).height.split('px')[0] ) * 1.6}px`;
}
else if(window.innerWidth >= 1440){
document.querySelector('.container-svg svg').style.width =
`${Number( window.getComputedStyle(document.querySelector('.container-svg svg') ).width.split('px')[0] ) * 2.6}px`;
document.querySelector('.container-svg svg').style.height =
`${Number( window.getComputedStyle(document.querySelector('.container-svg svg') ).height.split('px')[0] ) * 2.6}px`;
}
});
What specific areas of your project would you like help with?
Feel free to leave any comments.
Thanks.
Community feedback
- P@tsotneforesterPosted 3 days ago
Greate keyboard only solution, best so far what i have viewed. would like to be added some router for planets at least and for categories also and some hover effect is missing, but this is not tha important 😅👌
1P@Lo-DeckPosted about 4 hours ago@tsotneforester Thanks for your comments and your supports, what do you mean by 'added some router'.
0P@tsotneforesterPosted about 4 hours ago@Lo-Deck when you click planet, it should be seen in url ".../mars", ".../earth" so that when it is shared to anyone, by clicking he will go shared planet directly. for example in React this can be done by React Router. oh... I see you did it with vanilla JS, thats cool!
0
Please log in to post a comment
Log in with GitHubJoin 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