I've made a toggle menu with a hamburger image but every time i click on it works but the downside is, it doesn't disappear like it's supposed to using media queries, after clicking it would just stay visible pass a certain width. I'm thinking i have to do something with the for loops but i'm not too sure what to change.
#Help with javascript code for hamburger menu
4 messages · Page 1 of 1 (latest)
I honestly believe that's the one to blame. Since for bigger screens you have the "ham" always none by default.
And, maybe a little trouble right here:
When you declare the "getHam" variable, you're always getting only one element because you're getting it using "querySelector" function.
If you want to get all the instances of a particular class on the page (in that case ".ham"), you can use "querySelectorAll" instead.