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.37 kB
JavaScript
/*
* jQuery mmenu autoHeight addon
* mmenu.frebsite.nl
*
* Copyright (c) Fred Heusschen
*/
!function(t){var e="mmenu",i="autoHeight";t[e].addons[i]={setup:function(){if(this.opts.offCanvas){var s=this.opts[i];this.conf[i];if(a=t[e].glbl,"boolean"==typeof s&&s&&(s={height:"auto"}),"string"==typeof s&&(s={height:s}),"object"!=typeof s&&(s={}),s=this.opts[i]=t.extend(!0,{},t[e].defaults[i],s),"auto"==s.height||"highest"==s.height){this.$menu.addClass(h.autoheight);var n=function(e){if(this.vars.opened){var i=parseInt(this.$pnls.css("top"),10)||0,n=parseInt(this.$pnls.css("bottom"),10)||0,a=0;this.$menu.addClass(h.measureheight),"auto"==s.height?(e=e||this.$pnls.children("."+h.current),e.is("."+h.vertical)&&(e=e.parents("."+h.panel).not("."+h.vertical).first()),a=e.outerHeight()):"highest"==s.height&&this.$pnls.children().each(function(){var e=t(this);e.is("."+h.vertical)&&(e=e.parents("."+h.panel).not("."+h.vertical).first()),a=Math.max(a,e.outerHeight())}),this.$menu.height(a+i+n).removeClass(h.measureheight)}};this.bind("opening",n),"highest"==s.height&&this.bind("init",n),"auto"==s.height&&(this.bind("update",n),this.bind("openPanel",n),this.bind("closePanel",n))}}},add:function(){h=t[e]._c,s=t[e]._d,n=t[e]._e,h.add("autoheight measureheight"),n.add("resize")},clickAnchor:function(t,e){}},t[e].defaults[i]={height:"default"};var h,s,n,a}(jQuery);