swipe - mmenu - how to get the 'Drag open' Add-on on working with two menus? -


to open mmenu on swipe gesture, can include hammer.js , configure add-on in options when initializing menu (see http://mmenu.frebsite.nl/documentation/addons/drag-open.html):

_jq('#rightmenu').mmenu({             dragopen: true }, {     // configuration     clone: true });  _jq('#leftmenu').mmenu({             dragopen: true }, {     // configuration     clone: true }); 

that works fine 1 menu, have 2 menus on 1 site (one opening left side, 1 right), add-on work on first (the left) menu, not on second (right) menu. how work on both menus?

assuming:
1. menus have ids "left-menu" , "right-menu".
2. have couple of links on page can click on open eatch menu.
3. links ids "left-menu-link" , "right-menu-link".
4. divs reagions perform "swiperight" or "swipeleft" actions have css class named "swipeble-area".
load jquerymobile (eventualy with, only, required funcs.) , use same script this:

$(document).ready(function () {     $("div.swipeble-area").on("swipeleft swiperight", function (e) {         if ($("#left-menu").css("display") == "none" && $("#right-menu").css("display") == "none") {             if (e.type === "swiperight") {                 $("#left-menu-link").click();             } else if (e.type === "swipeleft") {                 $("#right-menu-link").click();             }         }     }); }); 

hope usefull.


Comments