update the readme with more information about the deltas

This commit is contained in:
Brandon Aaron
2013-11-14 15:51:15 -05:00
parent aa8b08ea45
commit adf892d7c0

View File

@@ -30,6 +30,24 @@ The old behavior of adding three arguments (`delta`, `deltaX`, and `deltaY`) to
event handler is now deprecated and will be removed in later releases.
## The Deltas...
The combination of Browsers, Operating Systems, and Devices offer a huge range of possible delta values. In fact if the user
uses a trackpad and then a physical mouse wheel the delta values can differ wildly. This plugin normalizes those
values so you get a whole number starting at +-1 and going up in increments of +-1 according to the force or
acceleration that is used. This number has the potential to be in the thousands depending on the device.
Check out some of the data collected from users [here](http://mousewheeldatacollector.herokuapp.com/).
### Getting the scroll distance
In some use-cases we prefer to have the normalized delta but in others we want to know how far the browser should
scroll based on the users input. This can be done by multiplying the `deltaFactor` by the `deltaX` or `deltaY`
event property to find the scroll distance the browser reported.
The `deltaFactor` property was added to the event object in 3.1.5 so that the actual reported delta value can be
extracted. This is a non-standard property.
## See it in action
[See the tests on Github](http://brandonaaron.github.io/jquery-mousewheel/test).