Prevent default when using 'useBothWheelAxes' option.
This commit is contained in:
@@ -288,6 +288,7 @@
|
|||||||
var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX,
|
var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX,
|
||||||
deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY;
|
deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY;
|
||||||
|
|
||||||
|
shouldPrevent = false;
|
||||||
if (!settings.useBothWheelAxes) {
|
if (!settings.useBothWheelAxes) {
|
||||||
// deltaX will only be used for horizontal scrolling and deltaY will
|
// deltaX will only be used for horizontal scrolling and deltaY will
|
||||||
// only be used for vertical scrolling - this is the default
|
// only be used for vertical scrolling - this is the default
|
||||||
@@ -301,6 +302,7 @@
|
|||||||
} else {
|
} else {
|
||||||
$this.scrollTop($this.scrollTop() + (deltaX * settings.wheelSpeed));
|
$this.scrollTop($this.scrollTop() + (deltaX * settings.wheelSpeed));
|
||||||
}
|
}
|
||||||
|
shouldPrevent = true;
|
||||||
} else if (scrollbarXActive && !scrollbarYActive) {
|
} else if (scrollbarXActive && !scrollbarYActive) {
|
||||||
// useBothWheelAxes and only horizontal bar is active, so use both
|
// useBothWheelAxes and only horizontal bar is active, so use both
|
||||||
// wheel axes for horizontal bar
|
// wheel axes for horizontal bar
|
||||||
@@ -309,12 +311,13 @@
|
|||||||
} else {
|
} else {
|
||||||
$this.scrollLeft($this.scrollLeft() - (deltaY * settings.wheelSpeed));
|
$this.scrollLeft($this.scrollLeft() - (deltaY * settings.wheelSpeed));
|
||||||
}
|
}
|
||||||
|
shouldPrevent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update bar position
|
// update bar position
|
||||||
updateBarSizeAndPosition();
|
updateBarSizeAndPosition();
|
||||||
|
|
||||||
shouldPrevent = shouldPreventDefault(deltaX, deltaY);
|
shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY));
|
||||||
if (shouldPrevent) {
|
if (shouldPrevent) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user