Plugin Author
malihu
(@malihu)
Hi,
The functionality of closing the mobile menu when navigating through sections of the same page, is not coming from the plugin (it comes from your theme).
For instance right now, you don’t have “Page scroll to id” activated and your mobile menu still stays open after you’ve clicked the links.
In order to do what you describe (i.e. auto-close the mobile menu when the links are clicked), you need to add an extra script in your page/template.
I have a dedicated page describing the solution for such issue here:
http://manos.malihu.gr/how-to-close-mobile-menu-with-page-scroll-to-id/
So, you basically need to:
1) Activate “Page scroll to id”.
2) Following the instructions here, add the following script:
<script>
(function($){
$(window).on("load",function(){
$(document).on("click",".menu-primary .menu-item ._mPS2id-h",function(){
$(".mobile-menu-button").trigger("click");
});
});
})(jQuery);
</script>
Let me know
Yes! thank you! I just changed the names of the classes that were not correct, and it works perfect!
Really thank you very much for your help. I’m a designer and I couldn’t have solved it alone.
Same problem, i’ve add the code and change the classes but does not work, menu dont collapse
the website is marcotermine.it
ive add this code:
<script>
(function($){
$(window).on("load",function(){
$(document).on("click",".offcanvas-menu-wrap .menu-item ._mPS2id-h",function(){
$(".kfi.kfi-close-alt2").trigger("click");
});
});
})(jQuery);
</script>
maybe i write the wrong classes?
thanks for your help
-
This reply was modified 4 years, 10 months ago by
DevilIce.
-
This reply was modified 4 years, 10 months ago by
DevilIce.
-
This reply was modified 4 years, 10 months ago by
DevilIce.
Plugin Author
malihu
(@malihu)
@devilice Try this:
(function($){
$(window).on("load",function(){
$(document).on("click","#offcanvas-menu .menu-item ._mPS2id-h",function(){
$(".kfi.kfi-close-alt2").trigger("click");
});
});
})(jQuery);
already tried with that code but without the #
now work!
the problem was the #
thanks