Skip to content
Advertisement

How to make work my mobile menu bar ‘display : none’ ‘display : block’

I’ve a navigation menu which dissappears when the breakpoint is 640px and an icon appears. When I click on this icon my menu reopens and it doesn’t close and when I resize the browser it doesn’t back to the normal style. For sure sth doesn’t work in my if satements.

Thanks for your help!

JavaScript

Advertisement

Answer

Try changing the else if statement from else if (window.innerWidth > '640' ) { to :else if (menuMobile.style.display != 'block'&& window.innerWidth > '640' ) {

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement