Answer the question
In order to leave comments, you need to log in
How to collapse a menu when clicking on a menu item?
Hello!
$(".toggle-menu").click(function() {
$(this).toggleClass("on");
$(this).parent().next().find(".hidden-menu").slideToggle();
return false;
});
$(".toggle-menu").click(function() {
$(this).toggleClass("on");
$(this).parent().next().find(".hidden-menu").slideToggle();
return false;
});
$(".hidden-menu ul li a").click(function() {
$(".toggle-menu").removeClass("on");
$(".hidden-menu").hide();
return false;
});
Answer the question
In order to leave comments, you need to log in
Maybe put the button and menu on the wrapper and only use toggleClass() on the wrapper.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question