Design comparison
SolutionDesign
Solution retrospective
My 3rd JS challenge. I used toggle() to lessen the code here so i'm not sure if there is a better way to do it. Also, i didn't know how to change the style in mobile when you toggle the share icon (If you know please comment and tell me how to do and i'll try it).
again, any comment will be appreciated :)
thank you!! <3
Community feedback
- @miroslavdurinPosted over 2 years ago
Hello and congratulations on completing this challenge!
I think that if you add this code to your media query should fix the issue:
.soc-med { left: unset; top: 5rem; right: 0; transform: none; }
I would also add a couple more suggestions:
- Perhaps it would be a good idea to add event handler on window to close the social-media popup, something like this:
window.addEventListener('click', (e) => { if(e.target.closest('.share-img')) return; if(!socMed.classList.contains('hidden')) socMed.classList.add('hidden') })
- It would also make more sense to put
img.share-img
inside of a<button>
element.
I hope it helped you a little bit :)
Marked as helpful2
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