|
1 | 1 | /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) |
2 | 2 | * Licensed under the MIT License (LICENSE.txt). |
3 | 3 | * |
4 | | - * Version: 3.1.7 |
| 4 | + * Version: 3.1.8-pre |
5 | 5 | * |
6 | 6 | * Requires: jQuery 1.2.2+ |
7 | 7 | */ |
|
23 | 23 | toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? |
24 | 24 | ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], |
25 | 25 | slice = Array.prototype.slice, |
26 | | - nullLowestDeltaTimeout, lowestDelta; |
| 26 | + oldMode, nullLowestDeltaTimeout, lowestDelta; |
27 | 27 |
|
28 | 28 | if ( $.event.fixHooks ) { |
29 | 29 | for ( var i = toFix.length; i; ) { |
|
32 | 32 | } |
33 | 33 |
|
34 | 34 | var special = $.event.special.mousewheel = { |
35 | | - version: '3.1.6', |
| 35 | + version: '3.1.8-pre', |
36 | 36 |
|
37 | 37 | setup: function() { |
38 | 38 | if ( this.addEventListener ) { |
|
137 | 137 |
|
138 | 138 | if ( !lowestDelta || absDelta < lowestDelta ) { |
139 | 139 | lowestDelta = absDelta; |
| 140 | + |
| 141 | + // Assuming that if the lowestDelta is 120, then that the browser |
| 142 | + // is treating this as an older mouse wheel event. |
| 143 | + // We'll divide it by 40 to try and get a more usable deltaFactor. |
| 144 | + if ( lowestDelta === 120 ) { |
| 145 | + oldMode = true; |
| 146 | + lowestDelta /= 40; |
| 147 | + } |
140 | 148 | } |
141 | 149 |
|
142 | | - // Assuming that if the lowestDelta is 120, then that the browser |
143 | | - // is treating this as an older mouse wheel event. |
144 | | - // We'll divide it by 40 to try and get a more usable deltaFactor. |
145 | | - if ( lowestDelta === 120 ) { |
| 150 | + // When in oldMode the delta is based on 120. We devide |
| 151 | + // by 40 to try and get a more usable deltaFactor. |
| 152 | + if ( oldMode ) { |
146 | 153 | // Divide all the things by 40! |
147 | | - delta /= 40; |
148 | | - deltaX /= 40; |
149 | | - deltaY /= 40; |
150 | | - lowestDelta /= 40; |
| 154 | + delta /= 40; |
| 155 | + deltaX /= 40; |
| 156 | + deltaY /= 40; |
151 | 157 | } |
152 | 158 |
|
153 | 159 | // Get a whole, normalized value for the deltas |
|
179 | 185 |
|
180 | 186 | function nullLowestDelta() { |
181 | 187 | lowestDelta = null; |
| 188 | + oldMode = null; |
182 | 189 | } |
183 | 190 |
|
184 | 191 | })); |
0 commit comments