I need help with the mobile menu. I'm trying to find/add a script that closes the menu after clicking a menu link. Can anyone help?
Thus, when you click on a menu link, you access the section, but the menu is still open. So I need a script that it should menu after clicking menu link.
Here is my GitHub for this repository: https://github.com/Eric8306/Remparts
Thanks in advance for your help and your js script :)
I tried some scripts I found on the web but it doesn't work. I am in training as a developer and I have not yet seen javascript, hence my problem. So I hope you can help me :)
Add below the code in your js file. Also include js library in head.
$(document).on("click",".header__nav .menu__list", function(){
$(".header__Hamburger").trigger("click");
});
Method 1:
if ($(window).width() < 768){
$(document).on("click",".header__nav .menu__list", function(){
$(".header__Hamburger").trigger("click");
});
}