update jquery.mousewheel.js to work with jquery 1.7

This commit is contained in:
j 2012-01-27 17:33:01 +05:30
parent 8d685a891c
commit 198e11c59b

18
source/Ox.UI/jquery/jquery.mousewheel.js Executable file → Normal file
View file

@ -1,11 +1,11 @@
/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt). * Licensed under the MIT License (LICENSE.txt).
* *
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY * Thanks to: Seamus Leahy for adding deltaX and deltaY
* *
* Version: 3.0.4 * Version: 3.0.6
* *
* Requires: 1.2.2+ * Requires: 1.2.2+
*/ */
@ -14,6 +14,12 @@
var types = ['DOMMouseScroll', 'mousewheel']; var types = ['DOMMouseScroll', 'mousewheel'];
if ($.event.fixHooks) {
for ( var i=types.length; i; ) {
$.event.fixHooks[ types[--i] ] = $.event.mouseHooks;
}
}
$.event.special.mousewheel = { $.event.special.mousewheel = {
setup: function() { setup: function() {
if ( this.addEventListener ) { if ( this.addEventListener ) {
@ -53,8 +59,8 @@ function handler(event) {
event.type = "mousewheel"; event.type = "mousewheel";
// Old school scrollwheel delta // Old school scrollwheel delta
if ( event.wheelDelta ) { delta = event.wheelDelta/120; } if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; }
if ( event.detail ) { delta = -event.detail/3; } if ( orgEvent.detail ) { delta = -orgEvent.detail/3; }
// New school multidimensional scroll (touchpads) deltas // New school multidimensional scroll (touchpads) deltas
deltaY = delta; deltaY = delta;
@ -72,7 +78,7 @@ function handler(event) {
// Add event and delta to the front of the arguments // Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY); args.unshift(event, delta, deltaX, deltaY);
return $.event.handle.apply(this, args); return ($.event.dispatch || $.event.handle).apply(this, args);
} }
})(jQuery); })(jQuery);