Menu doesn't close after clicking link

This will first check the device width before performing Samliew’s code to get around the desktop issue:

<script>
$('.w-nav-menu').on('click', 'a', function() {

  // When a nav item is clicked on a tablet or mobile device

    if (parseInt($(window).width()) < 990) {

	// Click the menu close button

        $('.w-nav-button').triggerHandler('tap');

    }

});
</script>
1 Like

I used this code to toggle a burger menu button when clicked in-page link, but it doesn’t work. Can you give any advise please?

I think the menu is on a fixed position

Hello guys !
Yuo can see my solution without code on my Site in component “header”.

It wery easy. I duplicate button "close/ open " mobile menu them i put link in this buttom. Important : this button and oblect inner hide on desktop.

This worked like a charm. Thanks so much!

This is fantastic, works perfectly. Cheers!

I am trying this code and it is not working. Do I need to change the value for .w-nav-menu and if so where would I find that value on my site?

Not sure if this is why for you but if you use code to make the nav menu close you can’t see it in effect in preview mode. It only shows once the site is published.

Hey can you explain how to do this? I can only seem to find animations to make my nav links wiggle and bounce etc.

Thank you! Working perfectly!