jQuery Plugin for Mouse Wheel Support - MouseWheel

File Size: 37.5 KB
Views Total: 29759
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin for Mouse Wheel Support - MouseWheel

The official jQuery mousewheel plugin that adds cross-browser mouse wheel support to your web projects.

It has been used for many years in a wide variety of jQuery plugins, websites and web applications. 

How to use it:

1.  Include jQuery Library and MouseWheel.js

<script src="jquery.min.js"></script>
<script src="jquery.mousewheel.js"></script>

2. Bind the "mousewheel" event to an element

<div id="demo"></demo>

3. An example of using both the bind and helper method syntax.

// using bind
$('#demo').bind('mousewheel', function(event, delta, deltaX, deltaY) {
  console.log(delta, deltaX, deltaY);
});

// using the event helper
$('#demo').mousewheel(function(event, delta, deltaX, deltaY) {
    console.log(delta, deltaX, deltaY);
});

Changelog:

v3.1.13 (2021-04-01)

  • Update dependencies

v3.1.13 (2019-09-11)

  • Update copyright notice and license to remove years
  • Create the correct compressed version
  • Remove the obsolete jQuery Plugin Registry file
  • Don't clobber mouse offset properties if we don't adjust them

v3.1.12 (2014-07-11)

  • Fix possible 0 value for line height when in delta mode 1
  • Fix version number for package managers.
  • Fix issue with calculating line height when using older versions of jQuery
  • Add offsetX/Y normalization with setting to turn it off
  • Cleans up data on teardown
  • Fix bower.json file
  • Updated how the deltas are adjusted for older mousewheel based events that have deltas that are factors of 120.
  • Add $.event.special.mousewheel.settings.adjustOldDeltas (defaults to true) to turn off adjusting of old deltas that are factors of 120. You'd turn this off if you want to be as close to native scrolling as possible.
  • Even better handling of older browsers that use a wheelDelta based on 120
  • And fix version reported by $.event.special.mousewheel
  • Better handle the deltaMode values 1 (lines) and 2 (pages)
  • Attempt to better handle older browsers that use a wheelDelta based on 120
  • Deprecating delta, deltaX, and deltaY event handler arguments
  • Update actual event object with normalized deltaXand deltaY values (event.deltaX, event.deltaY)
  • Add deltaFactor to the event object (event.deltaFactor)
  • Handle > 0 but < 1 deltas better
  • Do not fire the event if deltaX and deltaY are 0
  • Better handle different devices that give different lowestDelta values
  • Add $.event.special.mousewheel.version
  • Some clean up
  • Bad release because I did not update the new $.event.special.mousewheel.version

v3.1.4 (2013-10-19)

  • Always set the deltaY
  • Add back in the deltaX and deltaY support for older Firefox versions

v3.1.2 (2013-3-13)

  • Include MozMousePixelScroll in the to fix list to avoid inconsistent behavior in older Firefox

v3.1.1 (2013-2-24)

  • Fix rounding issue with deltas less than zero

v3.1.0 (2013-2-22)

  • 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

This awesome jQuery plugin is developed by jquery. For more Advanced Usages, please check the demo page or visit the official website.