UNPKG

jquery-mobile-menu-plugin

Version:

The best jQuery plugin for app look-alike on- and off-canvas menus with sliding submenus for your website and webapp.

7 lines 1.33 kB
/* * jQuery mmenu scrollBugFix addon * mmenu.frebsite.nl * * Copyright (c) Fred Heusschen */ !function(t){var o="mmenu",n="scrollBugFix";t[o].addons[n]={setup:function(){var r=this,i=this.opts[n];this.conf[n];if(s=t[o].glbl,t[o].support.touch&&this.opts.offCanvas&&this.opts.offCanvas.modal&&("boolean"==typeof i&&(i={fix:i}),"object"!=typeof i&&(i={}),i=this.opts[n]=t.extend(!0,{},t[o].defaults[n],i),i.fix)){var l=this.$menu.attr("id"),u=!1;this.bind("opening",function(){this.$pnls.children("."+e.current).scrollTop(0)}),s.$docu.on(c.touchmove,function(t){r.vars.opened&&t.preventDefault()}),s.$body.on(c.touchstart,"#"+l+"> ."+e.panels+"> ."+e.current,function(t){r.vars.opened&&(u||(u=!0,0===t.currentTarget.scrollTop?t.currentTarget.scrollTop=1:t.currentTarget.scrollHeight===t.currentTarget.scrollTop+t.currentTarget.offsetHeight&&(t.currentTarget.scrollTop-=1),u=!1))}).on(c.touchmove,"#"+l+"> ."+e.panels+"> ."+e.current,function(o){r.vars.opened&&t(this)[0].scrollHeight>t(this).innerHeight()&&o.stopPropagation()}),s.$wndw.on(c.orientationchange,function(){r.$pnls.children("."+e.current).scrollTop(0).css({"-webkit-overflow-scrolling":"auto"}).css({"-webkit-overflow-scrolling":"touch"})})}},add:function(){e=t[o]._c,r=t[o]._d,c=t[o]._e},clickAnchor:function(t,o){}},t[o].defaults[n]={fix:!0};var e,r,c,s}(jQuery);