Responsive as fudge using HTML, CCS and JS. Flex makes an appearance
Design comparison
Solution retrospective
This one took me a lot of time to do and was the first really big project I did.
I'd like feedback regarding my JS code and particularly how I access the DOM.
All feedback is greatly appreciated and thanks for taking a look!
Gareth
Community feedback
- @GrzywNPosted over 2 years ago
Great job on the challenge!
Your JS is decent, but you can make it more clean by assigning these weird looking
i.children[0].children[1]
for a variable and work on this variable instead of this thing. I recommend using more descriptive names for variables than just one letter (i
in that case) e.g. element, item, service etc. Remember to useconst
instead oflet
, if you are not reassigning a value to a variable (almost always querySelectors). It makes your code more readable.There is also weird looking if/else statement. You can just negate it with
!
mark.document.addEventListener('click', e => { if (e.target===servicesModal) { } else { hideModalLists(); } })
In this part of code you can just write
document.addEventListener('click', e => { if (e.target!==servicesModal) { hideModalLists(); } })
Hope this helps! Have a nice day and keep coding!
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