• Hello,

    I just want to add a function that automatically closes that collapsed offcanvas-menu after clicking on a item (e.g. #Residences). Here the code from the functions.js. For the desktop version and also for the mobile version please.

            //Offcanvas Menu
            $('[data-toggle="offcanvas"], .btn-offcanvas').on('click', function () {
                $('.row-offcanvas').toggleClass('active')
            });
    
            //mobile click
            $('#main-menu-offcanvas .caret').on('click', function () {
                var $a = jQuery(this);
                $a.parent().find('> .dropdown-menu').slideToggle();
                if ($a.parent().hasClass('level-0')) {
                    if($a.parent().hasClass('show')){
                        $a.parent().removeClass('show');
                    }else{
                        $a.parents('li').siblings('li').find('ul:visible').slideUp().parent().removeClass('show');
                        $a.parent().addClass('show');
                    }
                }
    
            });

    Thank you very much!

    • This topic was modified 4 years, 8 months ago by bartek11.
  • The topic ‘Offcanvas Menu closing after clicking on a item’ is closed to new replies.