I tried to do a hamburger menu when the screen is smaller than a certain size.
I can click the hamburger menu to show my list, but I failed to take the list back by clicking the button again.
I wonder if the logic of Js I wrote is correct?
Many thanks!
@Summerflowerling Your logic looks right to me. I’m not sure why your code isn’t working.
I’m not sure if this will help or if it’s the best way to do this, but I do this by adding and removing classes, i.e. remove a hide
class when clicked and add it again when clicked again using classList.
Here’s how I did this - main.js for technical documentation page
Thank you for sharing.
I will try to take a look and fix it.