Socket
Socket
Sign inDemoInstall

jquery-mousewheel

Package Overview
Dependencies
0
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.6 to 3.1.7

25

ChangeLog.md
# Mouse Wheel ChangeLog
## 3.1.7
* Better handle the `deltaMode` values 1 (lines) and 2 (pages)
* Attempt to better handle older browsers that use a wheelDelta based on 120
## 3.1.6
* Deprecating delta, deltaX, and deltaY event handler arguments
* Update actual event object with normalized deltaX and 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
* Deprecating `delta`, `deltaX`, and `deltaY` event handler arguments
* Update actual event object with normalized `deltaX `and `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

@@ -16,8 +21,8 @@

* Bad release because I did not update the new $.event.special.mousewheel.version
* Bad release because I did not update the new `$.event.special.mousewheel.version`
## 3.1.4
* Always set the deltaY
* Add back in the deltaX and deltaY support for older Firefox versions
* Always set the `deltaY`
* Add back in the `deltaX` and `deltaY` support for older Firefox versions

@@ -24,0 +29,0 @@ ## 3.1.3

60

jquery.mousewheel.js
/*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
* Licensed under the MIT License (LICENSE.txt).
*
* Version: 3.1.6
* Version: 3.1.7
*

@@ -34,3 +34,3 @@ * Requires: jQuery 1.2.2+

$.event.special.mousewheel = {
var special = $.event.special.mousewheel = {
version: '3.1.6',

@@ -46,2 +46,5 @@

}
// 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));
},

@@ -57,2 +60,10 @@

}
},
getLineHeight: function(elem) {
return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
},
getPageHeight: function(elem) {
return $(elem).height();
}

@@ -99,8 +110,8 @@ };

if ( 'deltaY' in orgEvent ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( 'deltaX' in orgEvent ) {
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
}

@@ -111,8 +122,37 @@

// 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;
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

@@ -127,2 +167,6 @@ delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);

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;

@@ -143,5 +187,5 @@ // Add event and delta to the front of the arguments

function nullLowestDelta() {
lowestDelta = null;
lowestDelta = null;
}
}));
{
"name": "jquery-mousewheel",
"version": "3.1.6",
"author": "Brandon Aaron <brandon.aaron@gmail.com> (http://brandonaaron.net/)",
"version": "3.1.7",
"author": "Brandon Aaron (http://brandon.aaron.sh)",
"description": "A jQuery plugin that adds cross-browser mouse wheel support.",
"license": "MIT",
"homepage": "https://github.com/brandonaaron/jquery-mousewheel",
"main": "./jquery.mousewheel.js",

@@ -23,13 +25,12 @@ "repository": {

],
"licenses": [
{
"type": "MIT",
"url": "https://raw.github.com/brandonaaron/jquery-mousewheel/master/LICENSE.txt"
}
"files": [
"ChangeLog.md",
"jquery.mousewheel.js",
"README.md"
],
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-connect": "~0.5.0"
"grunt-contrib-connect": "~0.5.0",
"grunt-contrib-jshint": "~0.7.1",
"grunt-contrib-uglify": "~0.2.7"
},

@@ -36,0 +37,0 @@ "directories": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc