javascript - How do I set different mmenu options by screen size? -


i'm using mmenu (http://mmenu.frebsite.nl) create mobile menu. implement jquery code :

 $('.mobile-menu .menu-block-wrapper').attr('id', 'menu-left');  $('.mobile-menu .menu-block-wrapper').mmenu({      configuration: {          selectedclass: "active",          menunodetype: "div",      },        dragopen : {           open: false,          threshold  : 100       }     });   $(".mobile-menu-trigger").trigger("open"); 

i'd like, when browser window less than, say, 720px, set dragopen true, , when switch normal resolution, set false.

any appreciated.

thanks

the plugin initializes dragging when fired. can't update option after plugin has been fired.

i guess bind function dragleft, dragright, dragup , dragdown events measures browser width and, if larger 720px, prevents propagation. this:

$("#page").on("dragleft dragright dragup dragdown", function( event ) {     if ( $(window).width() > 720 ) {         event.stopimmediatepropagation();         event.gesture.stopimmediatepropagation();     } else {         // plugin fire events bound dragleft/dragright/dragup/dragdown     } }); $('.mobile-menu .menu-block-wrapper').mmenu({     drag: {         open: true,         treshold: 100     } }); 

not sure if work though, having seen issue hammer.js: https://github.com/eightmedia/hammer.js/issues/333


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -