From be7cdf06dc683d0c81320474649c666281e8358c Mon Sep 17 00:00:00 2001
From: Brandon Aaron <brandon.aaron@gmail.com>
Date: Fri, 22 Feb 2013 10:03:48 -0600
Subject: [PATCH 01/10] setup gh-pages

---
 ChangeLog.markdown     |  76 ++++++++++
 LICENSE.txt            |  20 +++
 README.markdown        |  24 +++
 jquery.mousewheel.js   | 101 +++++++++++++
 mousewheel.jquery.json |  27 ++++
 test/index.html        | 330 +++++++++++++++++++++++++++++++++++++++++
 6 files changed, 578 insertions(+)
 create mode 100644 ChangeLog.markdown
 create mode 100644 LICENSE.txt
 create mode 100644 README.markdown
 create mode 100755 jquery.mousewheel.js
 create mode 100644 mousewheel.jquery.json
 create mode 100644 test/index.html

diff --git a/ChangeLog.markdown b/ChangeLog.markdown
new file mode 100644
index 00000000..c7185d11
--- /dev/null
+++ b/ChangeLog.markdown
@@ -0,0 +1,76 @@
+# Mouse Wheel ChangeLog
+
+# 3.1.0
+
+* Fix Firefox 17+ issues by using new wheel event
+* Normalize delta values
+* Adds horizontal support for IE 9+ by using new wheel event
+* Support AMD loaders
+
+
+# 3.0.6
+
+* Fix issue with delta being 0 in Firefox
+
+
+# 3.0.5
+
+* jQuery 1.7 compatibility
+
+
+# 3.0.4
+
+* Fix IE issue
+
+
+# 3.0.3
+
+* Added deltaX and deltaY for horizontal scrolling support (Thanks to Seamus Leahy)
+
+
+# 3.0.2
+
+* Fixed delta being opposite value in latest Opera
+* No longer fix pageX, pageY for older mozilla browsers
+* Removed browser detection
+* Cleaned up the code
+
+
+# 3.0.1
+
+* Bad release... creating a new release due to plugins.jquery.com issue :(
+
+
+# 3.0
+
+* Uses new special events API in jQuery 1.2.2+
+* You can now treat "mousewheel" as a normal event and use .bind, .unbind and .trigger
+* Using jQuery.data API for expandos
+
+
+# 2.2
+
+* Fixed pageX, pageY, clientX and clientY event properties for Mozilla based browsers
+
+
+# 2.1.1
+
+* Updated to work with jQuery 1.1.3
+* Used one instead of bind to do unload event for clean up.
+
+
+# 2.1
+
+* Fixed an issue with the unload handler
+
+
+# 2.0
+
+* Major reduction in code size and complexity (internals have change a whole lot)
+
+
+# 1.0
+
+* Fixed Opera issue
+* Fixed an issue with children elements that also have a mousewheel handler
+* Added ability to handle multiple handlers
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 00000000..d3d21c42
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright 2011, Brandon Aaron (http://brandonaaron.net/)
+ 
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+ 
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+ 
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.markdown b/README.markdown
new file mode 100644
index 00000000..453ed670
--- /dev/null
+++ b/README.markdown
@@ -0,0 +1,24 @@
+# jQuery Mouse Wheel Plugin
+
+A jQuery plugin that adds cross-browser mouse wheel support.
+
+In order to use the plugin, simply bind the "mousewheel" event to an element. It also provides two helper methods called `mousewheel` and `unmousewheel` that act just like other event helper methods in jQuery. The event callback receives three extra arguments which are the normalized "deltas" of the mouse wheel.
+
+Here is an example of using both the bind and helper method syntax.
+
+    // using bind
+    $('#my_elem').bind('mousewheel', function(event, delta, deltaX, deltaY) {
+        console.log(delta, deltaX, deltaY);
+    });
+
+    // using the event helper
+    $('#my_elem').mousewheel(function(event, delta, deltaX, deltaY) {
+        console.log(delta, deltaX, deltaY);
+    });
+
+
+## License
+
+This plugin is licensed under the MIT License (LICENSE.txt).
+
+Copyright (c) 2013 [Brandon Aaron](http://brandonaaron.net)
diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
new file mode 100755
index 00000000..8c603041
--- /dev/null
+++ b/jquery.mousewheel.js
@@ -0,0 +1,101 @@
+/*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
+ * Licensed under the MIT License (LICENSE.txt).
+ *
+ * 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: Seamus Leahy for adding deltaX and deltaY
+ *
+ * Version: 3.1.0
+ *
+ * Requires: 1.2.2+
+ */
+
+(function (factory) {
+    if (typeof define === 'function' && define.amd) {
+        // AMD. Register as an anonymous module.
+        define(['jquery'], factory);
+    } else {
+        // Browser globals
+        factory(jQuery);
+    }
+}(function ($) {
+
+    var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll'];
+    var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
+    var lowestDelta, lowestDeltaXY;
+
+    if ($.event.fixHooks) {
+        for ( var i=toFix.length; i; ) {
+            $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
+        }
+    }
+
+    $.event.special.mousewheel = {
+        setup: function() {
+            if ( this.addEventListener ) {
+                for ( var i=toBind.length; i; ) {
+                    this.addEventListener( toBind[--i], handler, false );
+                }
+            } else {
+                this.onmousewheel = handler;
+            }
+        },
+
+        teardown: function() {
+            if ( this.removeEventListener ) {
+                for ( var i=toBind.length; i; ) {
+                    this.removeEventListener( toBind[--i], handler, false );
+                }
+            } else {
+                this.onmousewheel = null;
+            }
+        }
+    };
+
+    $.fn.extend({
+        mousewheel: function(fn) {
+            return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
+        },
+
+        unmousewheel: function(fn) {
+            return this.unbind("mousewheel", fn);
+        }
+    });
+
+
+    function handler(event) {
+        var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, deltaX = 0, deltaY = 0, absDelta = 0, absDeltaXY = 0;
+        event = $.event.fix(orgEvent);
+        event.type = "mousewheel";
+
+        // Old school scrollwheel delta
+        if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta;  }
+        if ( orgEvent.detail     ) { delta = orgEvent.detail * -1; }
+
+        // New school wheel delta (wheel event)
+        if ( orgEvent.deltaY ) {
+            deltaY = orgEvent.deltaY * -1;
+            delta  = deltaY;
+        }
+        if ( orgEvent.deltaX ) {
+            deltaX = orgEvent.deltaX;
+            delta  = deltaX * -1;
+        }
+
+        // Webkit
+        if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY;      }
+        if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; }
+
+        absDelta = Math.abs(delta);
+        if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
+
+        absDeltaXY = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+        if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
+
+        // Add event and delta to the front of the arguments
+        args.unshift(event, Math.floor(delta/lowestDelta), Math.floor(deltaX/lowestDeltaXY), Math.floor(deltaY/lowestDeltaXY));
+
+        return ($.event.dispatch || $.event.handle).apply(this, args);
+    }
+
+}));
diff --git a/mousewheel.jquery.json b/mousewheel.jquery.json
new file mode 100644
index 00000000..4b52f1d7
--- /dev/null
+++ b/mousewheel.jquery.json
@@ -0,0 +1,27 @@
+{
+    "name": "mousewheel",
+    "title": "jQuery Mousewheel",
+    "description": "A jQuery plugin that adds cross-browser mouse wheel support.",
+    "keywords": [
+        "mousewheel",
+        "mouse",
+        "event"
+    ],
+    "version": "3.1.0",
+    "author": {
+        "name": "Brandon Aaron",
+        "url": "http://brandonaaron.net"
+    },
+    "licenses": [
+        {
+            "type": "MIT",
+            "url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
+        }
+    ],
+    "bugs": "https://github.com/brandonaaron/jquery-mousewheel/issues",
+    "homepage": "https://github.com/brandonaaron/jquery-mousewheel",
+    "download": "https://github.com/brandonaaron/jquery-mousewheel/tags",
+    "dependencies": {
+        "jquery": ">=1.2.2"
+    }
+}
diff --git a/test/index.html b/test/index.html
new file mode 100644
index 00000000..33191f53
--- /dev/null
+++ b/test/index.html
@@ -0,0 +1,330 @@
+<!doctype html>
+<html>
+    <head>
+        <title>Testing mousewheel plugin</title>
+
+        <script>
+            (function(){
+                    var verMatch = /v=([\w\.]+)/.exec( location.search ),
+                    version = verMatch && verMatch[1], src;
+                    if ( version ) {
+                            src = 'code.jquery.com/jquery-' + version;
+                    } else {
+                            src = 'code.jquery.com/jquery-git';
+                    }
+                    document.write( '<script src="http://' + src + '.js"><\/script>' );
+            })();
+        </script>
+        <script type="text/javascript" src="../jquery.mousewheel.js"></script>
+
+        <style>
+            #test1 {
+                background-color: #000;
+                width: 120px;
+                height: 100px;
+                color: #fff;
+                float: left;
+            }
+
+            #test2 {
+                background-color: #333;
+                width: 120px;
+                height: 100px;
+                color: #fff;
+                float: left;
+            }
+
+            #test3 {
+                background-color: #666;
+                width: 120px;
+                height: 100px;
+                color: #fff;
+                float: left;
+            }
+
+            #test4 {
+                background-color: #000;
+                width: 120px;
+                height: 100px;
+                color: #fff;
+                float: left;
+            }
+
+            #test5 {
+                background-color: #333;
+                padding: 5px;
+                width: 400px;
+                height: 400px;
+                color: #fff;
+                float: left;
+            }
+
+            #test6 {
+                background-color: #666;
+                padding: 5px;
+                width: 250px;
+                height: 250px;
+                color: #fff;
+                float: left;
+            }
+
+            #test7 {
+                background-color: #000;
+                padding: 5px;
+                width: 100px;
+                height: 100px;
+                color: #fff;
+                float: left;
+            }
+
+            #forceScroll {
+                clear: both;
+                height: 1000px;
+            }
+
+            #logger {
+                position: absolute;
+                top: 395px;
+                left: 12px;
+                width: 460px;
+                height: 290px;
+                overflow: auto;
+            }
+
+            #logger p {
+                font-family: Arial, sans-serif;
+                font-size: 13px;
+                padding: 2px;
+                border-bottom: 1px solid #ccc;
+                margin: 0;
+            }
+
+            #logger p:nth-child(even) {
+                background-color: #FFFFE8;
+            }
+
+            #logger p:nth-child(10n) {
+                border-bottom-color: #000;
+            }
+        </style>
+        <script type="text/javascript">
+            $(function() {
+                $('#userAgent').html(navigator.userAgent);
+
+
+                $('#test1')
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test1: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test1: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o );
+
+                        log('pageX: ' + event.pageX + ' pageY: ' + event.pageY );
+                    });
+
+                $('#test2')
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test2: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test2: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o );
+                        return false; // prevent default
+                    });
+
+                $('#test3')
+                    .hover(function() { log('#test3: mouseover'); }, function() { log('#test3: mouseout'); })
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        log('#test3: I should not have been logged');
+                    })
+                    .unmousewheel();
+
+                var testRemoval = function(event, delta, deltaX, deltaY) {
+                    log('#test4: I should not have been logged');
+                };
+
+                $('#test4')
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test4: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test4: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o );
+                        return false;
+                    })
+                    .mousewheel(testRemoval)
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test4: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test4: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o + ' from 2nd handler' );
+                        return false;
+                    })
+                    .unmousewheel(testRemoval);
+
+                $('#test5')
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test5: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test5: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o );
+
+                        event.stopPropagation();
+                        event.preventDefault();
+                    });
+
+                $('#test6')
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test6: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test6: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o );
+
+                        event.stopPropagation();
+                        event.preventDefault();
+                    });
+
+                $('#test7')
+                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                        var o = '';
+                        if (delta > 0)
+                            o = '#test7: up ('+delta+')';
+                        else if (delta < 0)
+                            o = '#test7: down ('+delta+')';
+
+                        if (deltaX > 0)
+                            o = o + ', east ('+deltaX+')';
+                        else if (deltaX < 0)
+                            o = o + ', west ('+deltaX+')';
+
+                        if (deltaY > 0)
+                            o = o + ', north ('+deltaY+')';
+                        else if (deltaY < 0)
+                            o = o + ', south ('+deltaY+')';
+
+                        if( o != '' )
+                            log( o );
+
+                        event.preventDefault();
+                    });
+
+                function log(msg) {
+                    $('#logger').append('<p>'+msg+'</p>').scrollTop(999999);
+                };
+            });
+        </script>
+    </head>
+    <body>
+        <h1 id="banner">jQuery mousewheel.js - Test</h1>
+        <h2 id="userAgent"></h2>
+
+        <ul>
+            <li><strong>Test1</strong> is just using the plain on mousewheel() with a function passed in and does not prevent default. (Also logs the value of pageX and pageY event properties.)</li>
+            <li><strong>Test2</strong> should prevent the default action.</li>
+            <li><strong>Test3</strong> should only log a mouseover and mouseout event. Testing unmousewheel().</li>
+            <li><strong>Test4</strong> has two handlers.</li>
+            <li><strong>Test5</strong> is like Test2 but has children. The children should not scroll until mousing over them.</li>
+            <li><strong>Test6</strong> is like Test5 but should not scroll children or parents.</li>
+            <li><strong>Test7</strong> is like Test6 but has no children. It will propagate the event and scroll test 6 as well.</li>
+        </ul>
+
+
+        <div id="test1"><p>Test1</p></div>
+        <div id="test2"><p>Test2</p></div>
+        <div id="test3"><p>Test3</p></div>
+        <div id="test4"><p>Test4</p></div>
+        <div id="test5">
+            <p>Test5</p>
+            <div id="test6">
+                <p>Test6</p>
+                <div id="test7"><p>Test7</p></div>
+            </div>
+        </div>
+
+        <div id="logger"></div>
+
+        <div id="forceScroll"></div>
+    </body>
+</html>

From 12f93fd3dd40dc83331492eeb7ad598234c27909 Mon Sep 17 00:00:00 2001
From: Brandon Aaron <brandon.aaron@gmail.com>
Date: Tue, 12 Mar 2013 09:33:37 -0500
Subject: [PATCH 02/10] update pages to latest version and point to root to
 test/index

---
 ChangeLog.markdown     | 76 ------------------------------------------
 LICENSE.txt            |  8 ++---
 README.markdown        | 24 -------------
 index.html             |  1 +
 jquery.mousewheel.js   | 42 +++++++++++++++--------
 mousewheel.jquery.json | 27 ---------------
 test/index.html        |  9 ++---
 7 files changed, 39 insertions(+), 148 deletions(-)
 delete mode 100644 ChangeLog.markdown
 delete mode 100644 README.markdown
 create mode 100644 index.html
 delete mode 100644 mousewheel.jquery.json

diff --git a/ChangeLog.markdown b/ChangeLog.markdown
deleted file mode 100644
index c7185d11..00000000
--- a/ChangeLog.markdown
+++ /dev/null
@@ -1,76 +0,0 @@
-# Mouse Wheel ChangeLog
-
-# 3.1.0
-
-* Fix Firefox 17+ issues by using new wheel event
-* Normalize delta values
-* Adds horizontal support for IE 9+ by using new wheel event
-* Support AMD loaders
-
-
-# 3.0.6
-
-* Fix issue with delta being 0 in Firefox
-
-
-# 3.0.5
-
-* jQuery 1.7 compatibility
-
-
-# 3.0.4
-
-* Fix IE issue
-
-
-# 3.0.3
-
-* Added deltaX and deltaY for horizontal scrolling support (Thanks to Seamus Leahy)
-
-
-# 3.0.2
-
-* Fixed delta being opposite value in latest Opera
-* No longer fix pageX, pageY for older mozilla browsers
-* Removed browser detection
-* Cleaned up the code
-
-
-# 3.0.1
-
-* Bad release... creating a new release due to plugins.jquery.com issue :(
-
-
-# 3.0
-
-* Uses new special events API in jQuery 1.2.2+
-* You can now treat "mousewheel" as a normal event and use .bind, .unbind and .trigger
-* Using jQuery.data API for expandos
-
-
-# 2.2
-
-* Fixed pageX, pageY, clientX and clientY event properties for Mozilla based browsers
-
-
-# 2.1.1
-
-* Updated to work with jQuery 1.1.3
-* Used one instead of bind to do unload event for clean up.
-
-
-# 2.1
-
-* Fixed an issue with the unload handler
-
-
-# 2.0
-
-* Major reduction in code size and complexity (internals have change a whole lot)
-
-
-# 1.0
-
-* Fixed Opera issue
-* Fixed an issue with children elements that also have a mousewheel handler
-* Added ability to handle multiple handlers
diff --git a/LICENSE.txt b/LICENSE.txt
index d3d21c42..d64b7076 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -1,5 +1,5 @@
-Copyright 2011, Brandon Aaron (http://brandonaaron.net/)
- 
+Copyright (c) 2013, Brandon Aaron (http://brandonaaron.net/)
+
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
@@ -7,10 +7,10 @@ without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
- 
+
 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.
- 
+
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
diff --git a/README.markdown b/README.markdown
deleted file mode 100644
index 453ed670..00000000
--- a/README.markdown
+++ /dev/null
@@ -1,24 +0,0 @@
-# jQuery Mouse Wheel Plugin
-
-A jQuery plugin that adds cross-browser mouse wheel support.
-
-In order to use the plugin, simply bind the "mousewheel" event to an element. It also provides two helper methods called `mousewheel` and `unmousewheel` that act just like other event helper methods in jQuery. The event callback receives three extra arguments which are the normalized "deltas" of the mouse wheel.
-
-Here is an example of using both the bind and helper method syntax.
-
-    // using bind
-    $('#my_elem').bind('mousewheel', function(event, delta, deltaX, deltaY) {
-        console.log(delta, deltaX, deltaY);
-    });
-
-    // using the event helper
-    $('#my_elem').mousewheel(function(event, delta, deltaX, deltaY) {
-        console.log(delta, deltaX, deltaY);
-    });
-
-
-## License
-
-This plugin is licensed under the MIT License (LICENSE.txt).
-
-Copyright (c) 2013 [Brandon Aaron](http://brandonaaron.net)
diff --git a/index.html b/index.html
new file mode 100644
index 00000000..e20a59c1
--- /dev/null
+++ b/index.html
@@ -0,0 +1 @@
+<meta http-equiv="refresh" content="0;URL='test/index.html'">
diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index 8c603041..38355c6a 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -5,15 +5,18 @@
  * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
  * Thanks to: Seamus Leahy for adding deltaX and deltaY
  *
- * Version: 3.1.0
+ * Version: 3.1.2
  *
  * Requires: 1.2.2+
  */
 
 (function (factory) {
-    if (typeof define === 'function' && define.amd) {
+    if ( typeof define === 'function' && define.amd ) {
         // AMD. Register as an anonymous module.
         define(['jquery'], factory);
+    } else if (typeof exports === 'object') {
+        // Node/CommonJS style for Browserify
+        module.exports = factory;
     } else {
         // Browser globals
         factory(jQuery);
@@ -24,8 +27,8 @@
     var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
     var lowestDelta, lowestDeltaXY;
 
-    if ($.event.fixHooks) {
-        for ( var i=toFix.length; i; ) {
+    if ( $.event.fixHooks ) {
+        for ( var i = toFix.length; i; ) {
             $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
         }
     }
@@ -33,7 +36,7 @@
     $.event.special.mousewheel = {
         setup: function() {
             if ( this.addEventListener ) {
-                for ( var i=toBind.length; i; ) {
+                for ( var i = toBind.length; i; ) {
                     this.addEventListener( toBind[--i], handler, false );
                 }
             } else {
@@ -43,7 +46,7 @@
 
         teardown: function() {
             if ( this.removeEventListener ) {
-                for ( var i=toBind.length; i; ) {
+                for ( var i = toBind.length; i; ) {
                     this.removeEventListener( toBind[--i], handler, false );
                 }
             } else {
@@ -64,13 +67,20 @@
 
 
     function handler(event) {
-        var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, deltaX = 0, deltaY = 0, absDelta = 0, absDeltaXY = 0;
+        var orgEvent = event || window.event,
+            args = [].slice.call(arguments, 1),
+            delta = 0,
+            deltaX = 0,
+            deltaY = 0,
+            absDelta = 0,
+            absDeltaXY = 0,
+            fn;
         event = $.event.fix(orgEvent);
         event.type = "mousewheel";
 
         // Old school scrollwheel delta
-        if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta;  }
-        if ( orgEvent.detail     ) { delta = orgEvent.detail * -1; }
+        if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
+        if ( orgEvent.detail )     { delta = orgEvent.detail * -1; }
 
         // New school wheel delta (wheel event)
         if ( orgEvent.deltaY ) {
@@ -83,17 +93,23 @@
         }
 
         // Webkit
-        if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY;      }
+        if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; }
         if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; }
 
+        // Look for lowest delta to normalize the delta values
         absDelta = Math.abs(delta);
         if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
-
-        absDeltaXY = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+        absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
         if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
 
+        // Get a whole value for the deltas
+        fn = delta > 0 ? 'floor' : 'ceil';
+        delta  = Math[fn](delta / lowestDelta);
+        deltaX = Math[fn](deltaX / lowestDeltaXY);
+        deltaY = Math[fn](deltaY / lowestDeltaXY);
+
         // Add event and delta to the front of the arguments
-        args.unshift(event, Math.floor(delta/lowestDelta), Math.floor(deltaX/lowestDeltaXY), Math.floor(deltaY/lowestDeltaXY));
+        args.unshift(event, delta, deltaX, deltaY);
 
         return ($.event.dispatch || $.event.handle).apply(this, args);
     }
diff --git a/mousewheel.jquery.json b/mousewheel.jquery.json
deleted file mode 100644
index 4b52f1d7..00000000
--- a/mousewheel.jquery.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
-    "name": "mousewheel",
-    "title": "jQuery Mousewheel",
-    "description": "A jQuery plugin that adds cross-browser mouse wheel support.",
-    "keywords": [
-        "mousewheel",
-        "mouse",
-        "event"
-    ],
-    "version": "3.1.0",
-    "author": {
-        "name": "Brandon Aaron",
-        "url": "http://brandonaaron.net"
-    },
-    "licenses": [
-        {
-            "type": "MIT",
-            "url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
-        }
-    ],
-    "bugs": "https://github.com/brandonaaron/jquery-mousewheel/issues",
-    "homepage": "https://github.com/brandonaaron/jquery-mousewheel",
-    "download": "https://github.com/brandonaaron/jquery-mousewheel/tags",
-    "dependencies": {
-        "jquery": ">=1.2.2"
-    }
-}
diff --git a/test/index.html b/test/index.html
index 33191f53..a7992c1f 100644
--- a/test/index.html
+++ b/test/index.html
@@ -1,6 +1,7 @@
-<!doctype html>
-<html>
+<!DOCTYPE html>
+<html lang="en">
     <head>
+        <meta charset="iso-8859-1">
         <title>Testing mousewheel plugin</title>
 
         <script>
@@ -15,7 +16,7 @@
                     document.write( '<script src="http://' + src + '.js"><\/script>' );
             })();
         </script>
-        <script type="text/javascript" src="../jquery.mousewheel.js"></script>
+        <script src="../jquery.mousewheel.js"></script>
 
         <style>
             #test1 {
@@ -107,7 +108,7 @@
                 border-bottom-color: #000;
             }
         </style>
-        <script type="text/javascript">
+        <script>
             $(function() {
                 $('#userAgent').html(navigator.userAgent);
 

From 2e8ff01a437e25bdd6c37d22f1dfab25d8c436f8 Mon Sep 17 00:00:00 2001
From: Brandon Aaron <brandon.aaron@gmail.com>
Date: Tue, 12 Mar 2013 17:39:11 -0500
Subject: [PATCH 03/10] update version

---
 jquery.mousewheel.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index 38355c6a..9d65c716 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -5,7 +5,7 @@
  * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
  * Thanks to: Seamus Leahy for adding deltaX and deltaY
  *
- * Version: 3.1.2
+ * Version: 3.1.3
  *
  * Requires: 1.2.2+
  */
@@ -23,7 +23,7 @@
     }
 }(function ($) {
 
-    var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll'];
+    var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];
     var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
     var lowestDelta, lowestDeltaXY;
 

From ac64835709e5789fbb4487ac630b2f28630a4ff9 Mon Sep 17 00:00:00 2001
From: Brandon Aaron <hello.brandon@aaron.sh>
Date: Fri, 18 Oct 2013 18:56:14 -0500
Subject: [PATCH 04/10] update to the latest version

---
 jquery.mousewheel.js | 39 ++++++++++++++++++++++-----------------
 test/index.html      | 38 ++++++++++++++++++++++----------------
 2 files changed, 44 insertions(+), 33 deletions(-)

diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index 9d65c716..e1d0e50b 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -1,11 +1,7 @@
-/*! Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
+/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
  * Licensed under the MIT License (LICENSE.txt).
  *
- * 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: Seamus Leahy for adding deltaX and deltaY
- *
- * Version: 3.1.3
+ * Version: 3.1.4
  *
  * Requires: 1.2.2+
  */
@@ -57,31 +53,40 @@
 
     $.fn.extend({
         mousewheel: function(fn) {
-            return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
+            return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
         },
 
         unmousewheel: function(fn) {
-            return this.unbind("mousewheel", fn);
+            return this.unbind('mousewheel', fn);
         }
     });
 
 
     function handler(event) {
-        var orgEvent = event || window.event,
-            args = [].slice.call(arguments, 1),
-            delta = 0,
-            deltaX = 0,
-            deltaY = 0,
-            absDelta = 0,
+        var orgEvent   = event || window.event,
+            args       = [].slice.call(arguments, 1),
+            delta      = 0,
+            deltaX     = 0,
+            deltaY     = 0,
+            absDelta   = 0,
             absDeltaXY = 0,
             fn;
         event = $.event.fix(orgEvent);
-        event.type = "mousewheel";
+        event.type = 'mousewheel';
 
         // Old school scrollwheel delta
         if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
         if ( orgEvent.detail )     { delta = orgEvent.detail * -1; }
 
+        // At a minimum, setup the deltaY to be delta
+        deltaY = delta;
+
+        // Firefox < 17 related to DOMMouseScroll event
+        if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
+            deltaY = 0;
+            deltaX = delta * -1;
+        }
+
         // New school wheel delta (wheel event)
         if ( orgEvent.deltaY ) {
             deltaY = orgEvent.deltaY * -1;
@@ -103,8 +108,8 @@
         if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
 
         // Get a whole value for the deltas
-        fn = delta > 0 ? 'floor' : 'ceil';
-        delta  = Math[fn](delta / lowestDelta);
+        fn     = delta > 0 ? 'floor' : 'ceil';
+        delta  = Math[fn](delta  / lowestDelta);
         deltaX = Math[fn](deltaX / lowestDeltaXY);
         deltaY = Math[fn](deltaY / lowestDeltaXY);
 
diff --git a/test/index.html b/test/index.html
index a7992c1f..9b34c55f 100644
--- a/test/index.html
+++ b/test/index.html
@@ -19,6 +19,9 @@
         <script src="../jquery.mousewheel.js"></script>
 
         <style>
+            #stage {
+                position: relative;
+            }
             #test1 {
                 background-color: #000;
                 width: 120px;
@@ -85,11 +88,12 @@
 
             #logger {
                 position: absolute;
-                top: 395px;
-                left: 12px;
-                width: 460px;
-                height: 290px;
+                top: 100px;
+                left: 0px;
+                width: 480px;
+                height: 310px;
                 overflow: auto;
+                z-index: 100;
             }
 
             #logger p {
@@ -111,6 +115,7 @@
         <script>
             $(function() {
                 $('#userAgent').html(navigator.userAgent);
+                $('#jqueryVersion').html($.fn.jquery);
 
 
                 $('#test1')
@@ -298,7 +303,7 @@
         </script>
     </head>
     <body>
-        <h1 id="banner">jQuery mousewheel.js - Test</h1>
+        <h1 id="banner">jQuery mousewheel.js Test with jQuery <span id="jqueryVersion"></span></h1>
         <h2 id="userAgent"></h2>
 
         <ul>
@@ -312,20 +317,21 @@ <h2 id="userAgent"></h2>
         </ul>
 
 
-        <div id="test1"><p>Test1</p></div>
-        <div id="test2"><p>Test2</p></div>
-        <div id="test3"><p>Test3</p></div>
-        <div id="test4"><p>Test4</p></div>
-        <div id="test5">
-            <p>Test5</p>
-            <div id="test6">
-                <p>Test6</p>
-                <div id="test7"><p>Test7</p></div>
+        <div id="stage">
+            <div id="test1"><p>Test1</p></div>
+            <div id="test2"><p>Test2</p></div>
+            <div id="test3"><p>Test3</p></div>
+            <div id="test4"><p>Test4</p></div>
+            <div id="test5">
+                <p>Test5</p>
+                <div id="test6">
+                    <p>Test6</p>
+                    <div id="test7"><p>Test7</p></div>
+                </div>
             </div>
+            <div id="logger"></div>
         </div>
 
-        <div id="logger"></div>
-
         <div id="forceScroll"></div>
     </body>
 </html>

From 13f02bc09bb16398147e383f257c687c708288bb Mon Sep 17 00:00:00 2001
From: Brandon Aaron <hello.brandon@aaron.sh>
Date: Tue, 26 Nov 2013 08:32:07 -0500
Subject: [PATCH 05/10] update to latest version

---
 jquery.mousewheel.js |  87 +++++++++------
 test/index.html      | 247 +++++++++++++------------------------------
 2 files changed, 125 insertions(+), 209 deletions(-)

diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index e1d0e50b..b3b17c25 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -1,9 +1,9 @@
 /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
  * Licensed under the MIT License (LICENSE.txt).
  *
- * Version: 3.1.4
+ * Version: 3.1.6
  *
- * Requires: 1.2.2+
+ * Requires: jQuery 1.2.2+
  */
 
 (function (factory) {
@@ -19,9 +19,11 @@
     }
 }(function ($) {
 
-    var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'];
-    var toBind = 'onwheel' in document || document.documentMode >= 9 ? ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'];
-    var lowestDelta, lowestDeltaXY;
+    var toFix  = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
+        toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
+                    ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
+        slice  = Array.prototype.slice,
+        nullLowestDeltaTimeout, lowestDelta;
 
     if ( $.event.fixHooks ) {
         for ( var i = toFix.length; i; ) {
@@ -30,6 +32,8 @@
     }
 
     $.event.special.mousewheel = {
+        version: '3.1.6',
+
         setup: function() {
             if ( this.addEventListener ) {
                 for ( var i = toBind.length; i; ) {
@@ -64,59 +68,74 @@
 
     function handler(event) {
         var orgEvent   = event || window.event,
-            args       = [].slice.call(arguments, 1),
+            args       = slice.call(arguments, 1),
             delta      = 0,
             deltaX     = 0,
             deltaY     = 0,
-            absDelta   = 0,
-            absDeltaXY = 0,
-            fn;
+            absDelta   = 0;
         event = $.event.fix(orgEvent);
         event.type = 'mousewheel';
 
         // Old school scrollwheel delta
-        if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta; }
-        if ( orgEvent.detail )     { delta = orgEvent.detail * -1; }
-
-        // At a minimum, setup the deltaY to be delta
-        deltaY = delta;
-
-        // Firefox < 17 related to DOMMouseScroll event
-        if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
+        if ( 'detail'      in orgEvent ) { deltaY = orgEvent.detail * -1;      }
+        if ( 'wheelDelta'  in orgEvent ) { deltaY = orgEvent.wheelDelta;       }
+        if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY;      }
+        if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
+
+        // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
+        if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
+            deltaX = deltaY * -1;
             deltaY = 0;
-            deltaX = delta * -1;
         }
 
+        // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
+        delta = deltaY === 0 ? deltaX : deltaY;
+
         // New school wheel delta (wheel event)
-        if ( orgEvent.deltaY ) {
+        if ( 'deltaY' in orgEvent ) {
             deltaY = orgEvent.deltaY * -1;
             delta  = deltaY;
         }
-        if ( orgEvent.deltaX ) {
+        if ( 'deltaX' in orgEvent ) {
             deltaX = orgEvent.deltaX;
-            delta  = deltaX * -1;
+            if ( deltaY === 0 ) { delta  = deltaX * -1; }
         }
 
-        // Webkit
-        if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY; }
-        if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = orgEvent.wheelDeltaX * -1; }
+        // No change actually happened, no reason to go any further
+        if ( deltaY === 0 && deltaX === 0 ) { return; }
+
+        // Store lowest absolute delta to normalize the delta values
+        absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+        if ( !lowestDelta || absDelta < lowestDelta ) {
+            lowestDelta = absDelta;
+        }
 
-        // Look for lowest delta to normalize the delta values
-        absDelta = Math.abs(delta);
-        if ( !lowestDelta || absDelta < lowestDelta ) { lowestDelta = absDelta; }
-        absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX));
-        if ( !lowestDeltaXY || absDeltaXY < lowestDeltaXY ) { lowestDeltaXY = absDeltaXY; }
+        // Get a whole, normalized value for the deltas
+        delta  = Math[ delta  >= 1 ? 'floor' : 'ceil' ](delta  / lowestDelta);
+        deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
+        deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
 
-        // Get a whole value for the deltas
-        fn     = delta > 0 ? 'floor' : 'ceil';
-        delta  = Math[fn](delta  / lowestDelta);
-        deltaX = Math[fn](deltaX / lowestDeltaXY);
-        deltaY = Math[fn](deltaY / lowestDeltaXY);
+        // Add information to the event object
+        event.deltaX = deltaX;
+        event.deltaY = deltaY;
+        event.deltaFactor = lowestDelta;
 
         // Add event and delta to the front of the arguments
         args.unshift(event, delta, deltaX, deltaY);
 
+        // Clearout lowestDelta after sometime to better
+        // handle multiple device types that give different
+        // a different lowestDelta
+        // Ex: trackpad = 3 and mouse wheel = 120
+        if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
+        nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
+
         return ($.event.dispatch || $.event.handle).apply(this, args);
     }
 
+    function nullLowestDelta() {
+        lowestDelta = null;
+    }
+
 }));
+
diff --git a/test/index.html b/test/index.html
index 9b34c55f..f04c80ce 100644
--- a/test/index.html
+++ b/test/index.html
@@ -4,54 +4,43 @@
         <meta charset="iso-8859-1">
         <title>Testing mousewheel plugin</title>
 
-        <script>
-            (function(){
-                    var verMatch = /v=([\w\.]+)/.exec( location.search ),
-                    version = verMatch && verMatch[1], src;
-                    if ( version ) {
-                            src = 'code.jquery.com/jquery-' + version;
-                    } else {
-                            src = 'code.jquery.com/jquery-git';
-                    }
-                    document.write( '<script src="http://' + src + '.js"><\/script>' );
-            })();
-        </script>
-        <script src="../jquery.mousewheel.js"></script>
-
         <style>
+            html {
+                font: 13px Arial, sans-serif;
+            }
+
             #stage {
+                color: #fff;
                 position: relative;
+                zoom: 1;
+            }
+
+            #test1, #test2, #test3, #test4, #test5, #test6, #test7 {
+                float: left;
             }
+
             #test1 {
                 background-color: #000;
                 width: 120px;
                 height: 100px;
-                color: #fff;
-                float: left;
             }
 
             #test2 {
                 background-color: #333;
                 width: 120px;
                 height: 100px;
-                color: #fff;
-                float: left;
             }
 
             #test3 {
                 background-color: #666;
                 width: 120px;
                 height: 100px;
-                color: #fff;
-                float: left;
             }
 
             #test4 {
                 background-color: #000;
                 width: 120px;
                 height: 100px;
-                color: #fff;
-                float: left;
             }
 
             #test5 {
@@ -59,8 +48,6 @@
                 padding: 5px;
                 width: 400px;
                 height: 400px;
-                color: #fff;
-                float: left;
             }
 
             #test6 {
@@ -68,8 +55,6 @@
                 padding: 5px;
                 width: 250px;
                 height: 250px;
-                color: #fff;
-                float: left;
             }
 
             #test7 {
@@ -77,8 +62,6 @@
                 padding: 5px;
                 width: 100px;
                 height: 100px;
-                color: #fff;
-                float: left;
             }
 
             #forceScroll {
@@ -89,7 +72,7 @@
             #logger {
                 position: absolute;
                 top: 100px;
-                left: 0px;
+                left: 0;
                 width: 480px;
                 height: 310px;
                 overflow: auto;
@@ -97,219 +80,133 @@
             }
 
             #logger p {
-                font-family: Arial, sans-serif;
-                font-size: 13px;
+                color: #000;
                 padding: 2px;
                 border-bottom: 1px solid #ccc;
                 margin: 0;
             }
 
             #logger p:nth-child(even) {
-                background-color: #FFFFE8;
+                background-color: #ffffe8;
             }
 
             #logger p:nth-child(10n) {
                 border-bottom-color: #000;
             }
         </style>
+
+        <script>
+            (function() {
+                var verMatch = /v=([\w\.]+)/.exec(location.search),
+                    version = verMatch && verMatch[1],
+                    src;
+                if (version)
+                    src = 'code.jquery.com/jquery-' + version;
+                else
+                    src = 'code.jquery.com/jquery-git';
+                document.write('<script src="http://' + src + '.js"><\/script>');
+            })();
+        </script>
         <script>
             $(function() {
                 $('#userAgent').html(navigator.userAgent);
                 $('#jqueryVersion').html($.fn.jquery);
 
+                var loghandle = function(event, delta) {
+                    var o = '', id = event.currentTarget.id;
 
-                $('#test1')
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test1: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test1: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o );
+                    o = '#' + id + ':';
+
+                    if (delta > 0)
+                        o += ' up (' + delta + ')';
+                    else if (delta < 0)
+                        o += ' down (' + delta + ')';
+
+                    if (event.deltaY > 0)
+                        o += ' north (' + event.deltaY + ')';
+                    else if (event.deltaY < 0)
+                        o += ' south (' + event.deltaY + ')';
 
+                    if (event.deltaX > 0)
+                        o += ' east (' + event.deltaX + ')';
+                    else if (event.deltaX < 0)
+                        o += ' west (' + event.deltaX + ')';
+
+                    o += ' deltaFactor (' + event.deltaFactor + ')';
+
+                    log( o );
+                };
+
+                $('#test1')
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         log('pageX: ' + event.pageX + ' pageY: ' + event.pageY );
                     });
 
                 $('#test2')
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test2: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test2: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o );
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         return false; // prevent default
                     });
 
                 $('#test3')
                     .hover(function() { log('#test3: mouseover'); }, function() { log('#test3: mouseout'); })
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
+                    .mousewheel(function() {
                         log('#test3: I should not have been logged');
                     })
                     .unmousewheel();
 
-                var testRemoval = function(event, delta, deltaX, deltaY) {
+                var testRemoval = function() {
                     log('#test4: I should not have been logged');
                 };
 
                 $('#test4')
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test4: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test4: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o );
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         return false;
                     })
                     .mousewheel(testRemoval)
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test4: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test4: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o + ' from 2nd handler' );
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         return false;
                     })
                     .unmousewheel(testRemoval);
 
                 $('#test5')
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test5: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test5: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o );
-
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         event.stopPropagation();
                         event.preventDefault();
                     });
 
                 $('#test6')
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test6: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test6: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o );
-
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         event.stopPropagation();
                         event.preventDefault();
                     });
 
                 $('#test7')
-                    .mousewheel(function(event, delta, deltaX, deltaY) {
-                        var o = '';
-                        if (delta > 0)
-                            o = '#test7: up ('+delta+')';
-                        else if (delta < 0)
-                            o = '#test7: down ('+delta+')';
-
-                        if (deltaX > 0)
-                            o = o + ', east ('+deltaX+')';
-                        else if (deltaX < 0)
-                            o = o + ', west ('+deltaX+')';
-
-                        if (deltaY > 0)
-                            o = o + ', north ('+deltaY+')';
-                        else if (deltaY < 0)
-                            o = o + ', south ('+deltaY+')';
-
-                        if( o != '' )
-                            log( o );
-
+                    .mousewheel(function(event, delta) {
+                        loghandle(event, delta);
                         event.preventDefault();
                     });
 
                 function log(msg) {
-                    $('#logger').append('<p>'+msg+'</p>').scrollTop(999999);
-                };
+                    $('#logger').append('<p>' + msg + '<\/p>')[0].scrollTop = 999999;
+                }
             });
         </script>
+        <script src="../jquery.mousewheel.js"></script>
     </head>
     <body>
         <h1 id="banner">jQuery mousewheel.js Test with jQuery <span id="jqueryVersion"></span></h1>
         <h2 id="userAgent"></h2>
 
         <ul>
-            <li><strong>Test1</strong> is just using the plain on mousewheel() with a function passed in and does not prevent default. (Also logs the value of pageX and pageY event properties.)</li>
+            <li><strong>Test1</strong> is just using the plain on <code>mousewheel()</code> with a function passed in and does not prevent default. (Also logs the value of <code>pageX</code> and <code>pageY</code> event properties.)</li>
             <li><strong>Test2</strong> should prevent the default action.</li>
-            <li><strong>Test3</strong> should only log a mouseover and mouseout event. Testing unmousewheel().</li>
+            <li><strong>Test3</strong> should only log a <code>mouseover</code> and <code>mouseout</code> event. Testing <code>unmousewheel()</code>.</li>
             <li><strong>Test4</strong> has two handlers.</li>
             <li><strong>Test5</strong> is like Test2 but has children. The children should not scroll until mousing over them.</li>
             <li><strong>Test6</strong> is like Test5 but should not scroll children or parents.</li>

From c2c7d669e4111ecee8a19aca5b6d7cb3d3a00a97 Mon Sep 17 00:00:00 2001
From: Brandon Aaron <hello.brandon@aaron.sh>
Date: Sat, 14 Dec 2013 13:38:07 -0500
Subject: [PATCH 06/10] update to 3.1.7

---
 jquery.mousewheel.js | 49 +++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 46 insertions(+), 3 deletions(-)

diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index b3b17c25..004079c7 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -1,7 +1,7 @@
 /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
  * Licensed under the MIT License (LICENSE.txt).
  *
- * Version: 3.1.6
+ * Version: 3.1.7
  *
  * Requires: jQuery 1.2.2+
  */
@@ -31,7 +31,7 @@
         }
     }
 
-    $.event.special.mousewheel = {
+    var special = $.event.special.mousewheel = {
         version: '3.1.6',
 
         setup: function() {
@@ -42,6 +42,9 @@
             } else {
                 this.onmousewheel = handler;
             }
+            // Store the line height and page height for this particular element
+            $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
+            $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
         },
 
         teardown: function() {
@@ -52,6 +55,14 @@
             } else {
                 this.onmousewheel = null;
             }
+        },
+
+        getLineHeight: function(elem) {
+            return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
+        },
+
+        getPageHeight: function(elem) {
+            return $(elem).height();
         }
     };
 
@@ -104,12 +115,41 @@
         // No change actually happened, no reason to go any further
         if ( deltaY === 0 && deltaX === 0 ) { return; }
 
+        // Need to convert lines and pages to pixels if we aren't already in pixels
+        // There are three delta modes:
+        //   * deltaMode 0 is by pixels, nothing to do
+        //   * deltaMode 1 is by lines
+        //   * deltaMode 2 is by pages
+        if ( orgEvent.deltaMode === 1 ) {
+            var lineHeight = $.data(this, 'mousewheel-line-height');
+            delta  *= lineHeight;
+            deltaY *= lineHeight;
+            deltaX *= lineHeight;
+        } else if ( orgEvent.deltaMode === 2 ) {
+            var pageHeight = $.data(this, 'mousewheel-page-height');
+            delta  *= pageHeight;
+            deltaY *= pageHeight;
+            deltaX *= pageHeight;
+        }
+
         // Store lowest absolute delta to normalize the delta values
         absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
+
         if ( !lowestDelta || absDelta < lowestDelta ) {
             lowestDelta = absDelta;
         }
 
+        // Assuming that if the lowestDelta is 120, then that the browser
+        // is treating this as an older mouse wheel event.
+        // We'll divide it by 40 to try and get a more usable deltaFactor.
+        if ( lowestDelta === 120 ) {
+            // Divide all the things by 40!
+            delta       /= 40;
+            deltaX      /= 40;
+            deltaY      /= 40;
+            lowestDelta /= 40;
+        }
+
         // Get a whole, normalized value for the deltas
         delta  = Math[ delta  >= 1 ? 'floor' : 'ceil' ](delta  / lowestDelta);
         deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
@@ -119,6 +159,10 @@
         event.deltaX = deltaX;
         event.deltaY = deltaY;
         event.deltaFactor = lowestDelta;
+        // Go ahead and set deltaMode to 0 since we converted to pixels
+        // Although this is a little odd since we overwrite the deltaX/Y
+        // properties with normalized deltas.
+        event.deltaMode = 0;
 
         // Add event and delta to the front of the arguments
         args.unshift(event, delta, deltaX, deltaY);
@@ -138,4 +182,3 @@
     }
 
 }));
-

From 3225b29b7a5fa054e318f64942545fc16ab3b6ee Mon Sep 17 00:00:00 2001
From: Brandon Aaron <hello.brandon@aaron.sh>
Date: Sat, 14 Dec 2013 14:25:22 -0500
Subject: [PATCH 07/10] update to 3.1.8 and add scroll test

---
 jquery.mousewheel.js | 30 +++++++++++++++++----------
 test/scroll.html     | 48 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 11 deletions(-)
 create mode 100644 test/scroll.html

diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index 004079c7..fbd568c3 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -1,7 +1,7 @@
 /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
  * Licensed under the MIT License (LICENSE.txt).
  *
- * Version: 3.1.7
+ * Version: 3.1.8
  *
  * Requires: jQuery 1.2.2+
  */
@@ -23,7 +23,7 @@
         toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
                     ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
         slice  = Array.prototype.slice,
-        nullLowestDeltaTimeout, lowestDelta;
+        oldMode, nullLowestDeltaTimeout, lowestDelta;
 
     if ( $.event.fixHooks ) {
         for ( var i = toFix.length; i; ) {
@@ -32,7 +32,7 @@
     }
 
     var special = $.event.special.mousewheel = {
-        version: '3.1.6',
+        version: '3.1.8',
 
         setup: function() {
             if ( this.addEventListener ) {
@@ -137,17 +137,23 @@
 
         if ( !lowestDelta || absDelta < lowestDelta ) {
             lowestDelta = absDelta;
+
+            // Assuming that if the lowestDelta is 120, then that the browser
+            // is treating this as an older mouse wheel event.
+            // We'll divide it by 40 to try and get a more usable deltaFactor.
+            if ( lowestDelta === 120 ) {
+              oldMode = true;
+              lowestDelta /= 40;
+            }
         }
 
-        // Assuming that if the lowestDelta is 120, then that the browser
-        // is treating this as an older mouse wheel event.
-        // We'll divide it by 40 to try and get a more usable deltaFactor.
-        if ( lowestDelta === 120 ) {
+        // When in oldMode the delta is based on 120.
+        // Dividing by 40 to try and get a more usable deltaFactor.
+        if ( oldMode ) {
             // Divide all the things by 40!
-            delta       /= 40;
-            deltaX      /= 40;
-            deltaY      /= 40;
-            lowestDelta /= 40;
+            delta  /= 40;
+            deltaX /= 40;
+            deltaY /= 40;
         }
 
         // Get a whole, normalized value for the deltas
@@ -179,6 +185,8 @@
 
     function nullLowestDelta() {
         lowestDelta = null;
+        oldMode = null;
     }
 
 }));
+
diff --git a/test/scroll.html b/test/scroll.html
new file mode 100644
index 00000000..70b9f649
--- /dev/null
+++ b/test/scroll.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Scroll Test</title>
+    <style>
+      html, body { margin: 0; padding: 0; width: 100%; height: 100%; }
+      #emulated, #native {
+        width: 40%;
+        height: 100%;
+      }
+      #emulated { float: left; overflow: hidden; }
+      #native { float: right; overflow: auto; }
+    </style>
+    <script>
+      (function() {
+        var verMatch = /v=([\w\.]+)/.exec(location.search),
+            version = verMatch && verMatch[1],
+            src;
+        if (version)
+          src = 'code.jquery.com/jquery-' + version;
+        else
+          src = 'code.jquery.com/jquery-git';
+        document.write('<script src="http://' + src + '.js"><\/script>');
+      })();
+    </script>
+    <script src="../jquery.mousewheel.js"></script>
+    <script>
+      var lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus rhoncus nibh ac ultricies blandit. Nunc blandit blandit lobortis. Maecenas id dolor scelerisque, facilisis dolor eu, interdum urna. Nullam consectetur lectus quis mi interdum accumsan. Nulla malesuada est nec neque suscipit pulvinar. Vivamus sagittis, nunc a porttitor tempus, mi neque eleifend diam, nec porttitor metus dui a orci. Cras tempus lobortis nisl ut sagittis. Maecenas semper in magna mollis venenatis. Vestibulum fermentum tincidunt fringilla.';
+      $(function() {
+        for (var i=0; i<30; i++) {
+          var html = '<p>' + i + ' ' + lorem + '</p>';
+          $('#emulated').append(html);
+          $('#native').append(html);
+        }
+        $('#emulated').bind('mousewheel', function(event) {
+          event.preventDefault();
+          var scrollTop = this.scrollTop;
+          this.scrollTop = (scrollTop + ((event.deltaY * event.deltaFactor) * -1));
+          //console.log(event.deltaY, event.deltaFactor, event.originalEvent.deltaMode, event.originalEvent.wheelDelta);
+        });
+      });
+    </script>
+  </head>
+  <body>
+    <div id="emulated"></div>
+    <div id="native"></div>
+  </body>
+</html>

From e76c798066531ac1854043704d7965ee801ef111 Mon Sep 17 00:00:00 2001
From: Brandon Aaron <hello.brandon@aaron.sh>
Date: Tue, 17 Dec 2013 10:32:03 -0500
Subject: [PATCH 08/10] update to latest version

---
 jquery.mousewheel.js | 37 +++++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/jquery.mousewheel.js b/jquery.mousewheel.js
index fbd568c3..63c968a8 100755
--- a/jquery.mousewheel.js
+++ b/jquery.mousewheel.js
@@ -1,7 +1,7 @@
 /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
  * Licensed under the MIT License (LICENSE.txt).
  *
- * Version: 3.1.8
+ * Version: 3.1.9
  *
  * Requires: jQuery 1.2.2+
  */
@@ -23,7 +23,7 @@
         toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
                     ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
         slice  = Array.prototype.slice,
-        oldMode, nullLowestDeltaTimeout, lowestDelta;
+        nullLowestDeltaTimeout, lowestDelta;
 
     if ( $.event.fixHooks ) {
         for ( var i = toFix.length; i; ) {
@@ -32,7 +32,7 @@
     }
 
     var special = $.event.special.mousewheel = {
-        version: '3.1.8',
+        version: '3.1.9',
 
         setup: function() {
             if ( this.addEventListener ) {
@@ -63,6 +63,10 @@
 
         getPageHeight: function(elem) {
             return $(elem).height();
+        },
+
+        settings: {
+            adjustOldDeltas: true
         }
     };
 
@@ -138,18 +142,14 @@
         if ( !lowestDelta || absDelta < lowestDelta ) {
             lowestDelta = absDelta;
 
-            // Assuming that if the lowestDelta is 120, then that the browser
-            // is treating this as an older mouse wheel event.
-            // We'll divide it by 40 to try and get a more usable deltaFactor.
-            if ( lowestDelta === 120 ) {
-              oldMode = true;
-              lowestDelta /= 40;
+            // Adjust older deltas if necessary
+            if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
+                lowestDelta /= 40;
             }
         }
 
-        // When in oldMode the delta is based on 120.
-        // Dividing by 40 to try and get a more usable deltaFactor.
-        if ( oldMode ) {
+        // Adjust older deltas if necessary
+        if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
             // Divide all the things by 40!
             delta  /= 40;
             deltaX /= 40;
@@ -185,8 +185,17 @@
 
     function nullLowestDelta() {
         lowestDelta = null;
-        oldMode = null;
     }
 
-}));
+    function shouldAdjustOldDeltas(orgEvent, absDelta) {
+        // If this is an older event and the delta is divisable by 120,
+        // then we are assuming that the browser is treating this as an
+        // older mouse wheel event and that we should divide the deltas
+        // by 40 to try and get a more usable deltaFactor.
+        // Side note, this actually impacts the reported scroll distance
+        // in older browsers and can cause scrolling to be slower than native.
+        // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
+        return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
+    }
 
+}));

From f2a9f9170c2e1b84cd95026bf276014436405fb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?=
 <m.goleb@gmail.com>
Date: Thu, 30 Apr 2020 08:58:08 +0200
Subject: [PATCH 09/10] Use https for code.jquery.com in index.html

---
 test/index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/index.html b/test/index.html
index f04c80ce..26f12d73 100644
--- a/test/index.html
+++ b/test/index.html
@@ -104,7 +104,7 @@
                     src = 'code.jquery.com/jquery-' + version;
                 else
                     src = 'code.jquery.com/jquery-git';
-                document.write('<script src="http://' + src + '.js"><\/script>');
+                document.write('<script src="https://' + src + '.js"><\/script>');
             })();
         </script>
         <script>

From 3c9adedfae55ea95de4957da372d2a659ab6de6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?=
 <m.goleb@gmail.com>
Date: Thu, 30 Apr 2020 08:58:55 +0200
Subject: [PATCH 10/10] Use https for code.jquery.com in scroll.html

---
 test/scroll.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/scroll.html b/test/scroll.html
index 70b9f649..15fa87f1 100644
--- a/test/scroll.html
+++ b/test/scroll.html
@@ -20,7 +20,7 @@
           src = 'code.jquery.com/jquery-' + version;
         else
           src = 'code.jquery.com/jquery-git';
-        document.write('<script src="http://' + src + '.js"><\/script>');
+        document.write('<script src="https://' + src + '.js"><\/script>');
       })();
     </script>
     <script src="../jquery.mousewheel.js"></script>