Team:SYSU-Software/jquery.mousewheel.js

From 2014.igem.org

Revision as of 15:28, 16 October 2014 by Huangmin1012 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function g(b){var l,c=b||window.event,f=[].slice.call(arguments,1),g=0,h=0,i=0,j=0,k=0;return b=a.event.fix(c),b.type="mousewheel",c.wheelDelta&&(g=c.wheelDelta),c.detail&&(g=-1*c.detail),c.deltaY&&(i=-1*c.deltaY,g=i),c.deltaX&&(h=c.deltaX,g=-1*h),void 0!==c.wheelDeltaY&&(i=c.wheelDeltaY),void 0!==c.wheelDeltaX&&(h=-1*c.wheelDeltaX),j=Math.abs(g),(!d||d>j)&&(d=j),k=Math.max(Math.abs(i),Math.abs(h)),(!e||e>k)&&(e=k),l=g>0?"floor":"ceil",g=Math[l](g/d),h=Math[l](h/e),i=Math[l](i/e),f.unshift(b,g,h,i),(a.event.dispatch||a.event.handle).apply(this,f)}var d,e,f,b=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],c="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(a.event.fixHooks)for(f=b.length;f;)a.event.fixHooks[b[--f]]=a.event.mouseHooks;a.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],g,!1);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],g,!1);else this.onmousewheel=null}},a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});