Menu not closing on mobile when using anchor links

Good day

Please help me with a fix for the following.

I’ve noticed that on mobile the menu does not automatically close when the links are selected. The anchors are setup correctly as they navigate to the correct sections if I manually close the menu.

I’ve created a one-page with a few sections, with anchors. I did a bit of research and found this jquery code, but not sure if it would work or where or how it should be added to the site.

Please help.

(function($) { 
    $('.nav-menu a').on('click', function(){
        if ( $(this).data('toggle') !== 'dropdown' ) {
            $('.main-menu .close-button').click();
        }
    });
})(jQuery);

Hi,

Yes, this is the expected behavior in this version because many people use url# simply for parent items so that it does not close the menu. If you mean in-page navigation, please try adding it inside the page as a table of contents.

Hello Andrii. I used the url/# method from the menu to a section on the same page.

Desktop works, but on mobile the menu doesn’t close.

Hi,

I see. Yes, this is a minor issue on mobile view; we will fix it as soon as possible. As a workaround, we recommend that you do not use the main menu for in-page navigation but add a link, for example, at the top of the page in the menu (in the content itself).