Fix that wheelPropagation option doesn't work in Firefox.

This commit is contained in:
Hyunje Alex Jun 2013-08-06 15:14:55 +09:00
parent 74f97e330e
commit cf8cea8b13

View File

@ -239,6 +239,7 @@
return true; return true;
}; };
var shouldPrevent = false;
$this.bind('mousewheel.perfect-scroll', function (e, delta, deltaX, deltaY) { $this.bind('mousewheel.perfect-scroll', function (e, delta, deltaX, deltaY) {
$this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed)); $this.scrollTop($this.scrollTop() - (deltaY * settings.wheelSpeed));
$this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed)); $this.scrollLeft($this.scrollLeft() + (deltaX * settings.wheelSpeed));
@ -246,14 +247,18 @@
// update bar position // update bar position
updateBarSizeAndPosition(); updateBarSizeAndPosition();
if (shouldPreventDefault(deltaX, deltaY)) { shouldPrevent = shouldPreventDefault(deltaX, deltaY);
if (shouldPrevent) {
e.preventDefault(); e.preventDefault();
} }
}); });
// fix Firefox scroll problem // fix Firefox scroll problem
$this.bind('DOMMouseScroll.perfect-scroll', function (e) { e.preventDefault(); }); $this.bind('MozMousePixelScroll.perfect-scroll', function (e) {
$this.bind('MozMousePixelScroll.perfect-scroll', function (e) { e.preventDefault(); }); if (shouldPrevent) {
e.preventDefault();
}
});
}; };
// bind mobile touch handler // bind mobile touch handler