From d3181f0b0dcb396cd2598bd9d2cfb867592d02e1 Mon Sep 17 00:00:00 2001 From: Hyunje Alex Jun Date: Mon, 15 Sep 2014 22:53:40 +0100 Subject: [PATCH] Mousewheel fixes for Firefox and IE 10. Now tested with the latest versions of following browsers. In OS X: Chrome Firefox Safari In Windows: Chrome Firefox Internet Explorer 10 Opera Safari --- src/perfect-scrollbar.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/perfect-scrollbar.js b/src/perfect-scrollbar.js index a0b01e2..1241f3e 100644 --- a/src/perfect-scrollbar.js +++ b/src/perfect-scrollbar.js @@ -348,6 +348,18 @@ deltaY = e.originalEvent.wheelDeltaY / 6; } + if (e.originalEvent.deltaMode && e.originalEvent.deltaMode === 1) { + // Firefox in deltaMode 1: Line scrolling + deltaX *= 10; + deltaY *= 10; + } + + if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) { + // IE in some mouse drivers + deltaX = 0; + deltaY = e.originalEvent.wheelDelta; + } + return [deltaX, deltaY]; };