javascript - Mmenu: opening multiple panels in correct order -
i have following side sliding menu configured.
$("#menu").mmenu({ extensions: ['fullscreen', 'border-offset'], columns: true, offcanvas: { position: "top" } }); i open menu on item current page. can not achieve using setselected reason. have side menu work can set position during init. menu need able provide button opens either root or button opens @ current page.
the way work iterate through each panel until root. in addition need delay because order although visually ok incorrect when start closing panels clicking carrots. smallest delay around 100ms before breaks. order of panels appears tracked internally once transition has completed when doing 'openpanel' or .click().
var api = $("#menu").data( "mmenu" ); $('#open').click(function (e) { e.preventdefault(); // finds ids of pannels want open var parents = findparents(selectedel, []).reverse(); parents.push(currentid); // not appear anything, current.parent() <li> of current item api.setselected(current.parent(), true); // min delay 100 or mmenu api not catch transition in correct order var opendelay = 100; var time = opendelay; $.each( parents, function( key, value ) { settimeout( function(){ // open panel in menu api.openpanel($(value)); }, time); time += opendelay; }); // open menu api.open(); } i stuck on 5.7.8, know if possibly fixed in later version?
Comments
Post a Comment