Design comparison
Solution retrospective
I have difficulty for hamburger menu on mobile, as you guys can see if you visit the website, i can open (click the hamburger) and then mobile links show up, but if you click it again, it won't close. If you have the solution for my problem, please teach me.
I also have difficulty with responsive wesbite
Community feedback
- @SatellitePeacePosted about 2 years ago
Hello @wshena your work looks great on mobile here is a tip for creating small screen menus
Instead of changing the heigth from negative to positive values why not set the menu container to display:none
add a new class in the css and set it to display:block then use if/else statement to Target the menu and to toggle the menu
Like this
CSS slider{ display:none } .slider.show{ display:block } JS function openAndCloseNav(){ // mainNavbar.addEventListener('click', () => { slider.classList.toggle(show) }); } openAndCloseNav()
If you want nice animations you can use transform property to achieve that instead of display:none
Doing it this way reduces your code a bit and gives you the same result
I hope this helps
Marked as helpful0@wshenaPosted about 2 years ago@SatellitePeace Hi, thanks for your advice. I will definitely try to implement it in the next challenge. Thank you
1
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