Skip to content
Advertisement

Close my spans when I click on my a inside my menu

I made a responsive menu a few days ago, it’s working pretty well except when I click my a inside the menu-ul I created, it closes the menu but not the state of my burger menu spans.

Here is the code so you can understand

JavaScript
JavaScript
JavaScript

Can someone help me with this? I already checked some subjects close to mine, but didn’t find the answer resolving my problem. Thank you very much! 🙂

Advertisement

Answer

This’s happening because your checkbox is not unchecked, if you click on menu item. You can modify function like this:

JavaScript

And add id-attribute to input[type=”checkbox”]:

JavaScript

I hope, this will help you!

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