Hide mobile menu after click to a menu item

Hi,

I have problems in the new sydney theme’s mobile menu.

Whenever a menu item in the mobile slider menu is clicked, the slider menu remains opened. To close it you will have to click the close icon, but after this on a one-page website, the top of the page appears instead of the selected ID.

I tried a solution, which you say in this forum, but didn’t work to me:

(function($){

    if( matchMedia('only screen and (max-width: 1024px)') ) {
        $( document ).on('click', function(e){
            if( !$( e.target ).closest('.mainnav').length ) {
                $('.mainnav').removeClass('toggled');
            }
        });
    }

})(jQuery);

Is it possible to make the slider menu automatically close after a menu item is clicked?

Thank you!

Hello Guys,

I solved the problem with this code:

(function($){

    if( matchMedia('only screen and (max-width: 1024px)') ) {
        $( document ).on('click', function(e){
            if( !$( e.target ).closest('.menu-toggle').length ) {
                $('.sydney-offcanvas-menu').removeClass('toggled');
            }
        });
    }

})(jQuery);

Hello,

Great that you figured this out!

If you need further assistance, feel free to contact us.

Kind Regards,

Rodrigo.

aThemes Support