How to make the mmenu default expanded

2.2k views Asked by At

I am using Jquery mmenu for my application. My menu contains sub menus. Sub menus are expanded only when user clicks on the main menu item. I want that expanded by default when user clicks on the menu button. How is this possible? I have initialized as follows.

$(document).ready(function () {
console.log('mmenu loading');
$("#menu").mmenu({
    slidingSubmenus: false
});

});

Any help is really appreciated.

Thank You

1

There are 1 answers

2
Rushee On BEST ANSWER

You can give the class ( "mm-opened" ) to the menu which have submenu.

<nav id="menu">
            <ul>
                <li><a href="#">Home</a></li>
                //MENU WITH SUBMENU ADD CLASS mm-opened
                <li class="mm-opened">
                    <a href="#about">About us</a>
                    <ul>
                        <li><a href="#about/history">History</a></li>
                        <li> <a href="#about/team">The team</a></li>
                        <li><a href="#about/address">Our address</a></li>
                    </ul>
                </li>
                <li><a href="#contact">Contact</a></li>
            </ul>
</nav>

AND slidingSubmenus to false.

$("#menu").mmenu({
    slidingSubmenus: false
});