Design comparison
Solution retrospective
Could someone assist me in solving this issue with the dropdown menu in the mobile version? It's closing when clicking anywhere within the "container-navbar" div. It was working correctly before, but at some point, this started happening, and I'm unable to fix it.
Community feedback
- @MLimadPosted over 1 year ago
Hello .. From your code Html remove input checkbox and in the script js add some changes like this
const open = document.getElementById('open'); const close = document.getElementById('close'); const menu = document.getElementById('container'); const page = document.getElementById('page'); const navebar = document.getElementById('navebar');
// Open DropDown open.addEventListener('click', function() { open.style.display = 'none'; close.style.display = 'block'; menu.style.display = 'block'; }); // Close DropDown close.addEventListener('click', function() { open.style.display = 'block'; close.style.display = 'close'; menu.style.display = 'none'; });
like you see i removed input variable and i created two functions one for open the dropdown and the other for close it
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