• Hello,
    I need to use anchors on one subpage. Is it possible to close the mobile menu if I click on anchor link. If I click from another page there is no problem, because page reloads. However, if I’m on the same page (with anchors) – clicking the link scrolls the page to the appropriate section, but mobile menu is still active and covers the page.
    I considered using such code. Can it be adapted to your theme?

    <script>
    jQuery(document).ready(function( $ ){
    
    if (jQuery(window).width() < 960) {
        jQuery('.navbar-collapse a').click(function (e) {  
            if( jQuery(e.target).is('a') && jQuery(e.target).attr('class') != 'dropdown-toggle' ) {
                jQuery('.navbar-collapse').collapse('toggle');
            }
        });
    }
    });
    </script>
  • The topic ‘Close mobile menu after click’ is closed to new replies.