I'm trying to make a simple "hamburger menu" on my website. When you click the burger icon, a menu pops up, and it goes away when you either click the burger or anywhere else outside the menu.It works except for one part. Once the menu is open, I can't close it by pressing the same burger button again. There's some logical conflict here that I'm too dumb to detect.The part that doesn't work is this:>if(menu.style.display == "block") {>menu.style.display = "none";>}Menu means the actual pop-up menu, menubtn is the burgerbutton that opens up the menu.Another issue: this won't work on my cellphone, only computer. I'm not a JS guy
baka! line 79 should be else if (or a switch/case statement). when the menu is open and you click the button, line 76 activates and closes the menu, then line 79 activates and, because the menu is closed, re-opens the menuthis is what debuggers/steppers are for, anon!
>>1540995Thank you anoned.What's a debugger/stepper? I'm using notepad.exe.Also, any idea why the code doesnt work on mobile?
>>1541003>What's a debugger/stepper?A tool you use for debugging by stepping through your code.Stepping means exactly that, going step by step. Instead if it zipping throug in a microsecond you do one action, stop, next step, where is the priogram now, what values does it get, next step, where are we now, where did it jump, etc...
>>1541003What's a debugger/stepper?wow man go learn to use a debugger. it will save you soooo many headaches.