More optimizations
***Note: there is a bug in the hamburger menu code where if you open the mobile menu, then without closing it switch to tablet/desktop view, then switch back to mobile again, you can't click anything on the site.
What you need to do is close the mobile menu if the site changes to tablet/desktop. You can do this by running closeMobileMenu()
in the desktop logic in the setupTopNav()
function:
const setupTopNav = () => {
if (breakpoint.matches) {
// console.log('is mobile');
menuTopNav.setAttribute('inert', '');
} else {
// console.log('is tablet/desktop');
closeMobileMenu();
menuTopNav.removeAttribute('inert');
}
};
0 comments