Mobile menu toggle off click event
-
I wanted to add css when the menu is toggled and replace the css back when a user closes the menu
document.querySelector(“.mega-menu-toggle”).addEventListener(‘click’, function() {
document.querySelector(“body”).style.overflow = ‘hidden’;
document.querySelector(“.av_one_full”).style.zIndex = “-1”;
});I have used this and it works fine when I open the menu but when I close the menu it remains. Can u tell me hoe can i apply or target a queryselector for close event?
I wanna use something like this
document.querySelector(“.mega-menu-toggle-close”).addEventListener(‘click’, function() {
document.querySelector(“body”).style.overflow = ‘visible’;
document.querySelector(“.av_one_full”).style.zIndex = “1”;
});
- The topic ‘Mobile menu toggle off click event’ is closed to new replies.