Dropdown navigation and responsive menu

Solution retrospective
Hello everyone. This is the first challenge where I really challenged myself to find solutions, to try and then to fail (a lot). That made me crazy is the burger menu, I spent an indecent amount of time there. There are still a lot of things missing. The close button doesn't appearing. Moreover, I haven't found how to put a shadow on the left when the menu opens if you can give me some hints !
Please log in to post a comment
Log in with GitHubCommunity feedback
- @AdrianoEscarabote
Hi Lea, how are you?
I really liked the result of your project, but I have some tips that I think you will enjoy:
To make the close button on the
burguer menu
appear, we can do this:First take the element you want to manipulate and store it in a variable, then we will add a conditional structure, which will check if the menu has a
classList
, and if it returns true the element will have itssrc
attribute changed:function toggleMenu () toggle.addEventListener('click', () => { menu.classList.toggle('open-nav'); if (menu.classList.contains('open-nav')) { imgMenu.setAttribute("src", "images/some-name.svg") } else { imgMenu.setAttribute("src", "images/name.svg") } }); }
The rest is great!
I hope it helps... 👍
Marked as helpful
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