jquerymmenu

jQuery mmenu open submenu from outside the menu structure


I'm trying to figure out a way to trigger a submenu from outside the mmenu structure.

Opening a submenu with a link directly refering to the mmenu id, doesn't work:

<div class="content">
   <a href="#mm-2">Open submenu from here</a>
</div>

http://jsfiddle.net/9FdXv/40/


Solution

  • Add the id external or whatever you like to your external anchor. Also add an id to the ul constituing your "80% werken" menu. (In this example I used 80_sub). Now add the following to your js script:

    $('#external').click(function(ev) {
        ev.preventDefault(); //Avoid mmenu to get the click and close
        var api = $("#my-menu").data( "mmenu" );
        api.openPanel( $("#80_sub") );
    });

    We are manually manipulating the menu using the API.

    Edit: Working example based on your fiddle.