cubiq/iscroll — Issue #140: Mousewheel event in Firefox makes iScroll scroll in both directions [Patch included]
Author: damianmr
Created: 2011-10-25 15:29:05+00:00
State: open

When using iScroll to scroll an element, if you use the mouse wheel to scroll in Firefox the scroll area moves in both axis.

Just a small patch will fix this issue:

in function _wheel:

```javascript
if ('wheelDeltaX' in e) {
wheelDeltaX = e.wheelDeltaX / 12;
wheelDeltaY = e.wheelDeltaY / 12;
} else if ('detail' in e) {
wheelDeltaX = wheelDeltaY = -e.detail * 3;
} else {
wheelDeltaX = wheelDeltaY = -e.wheelDelta;
}
```

Should be:
```javascript
if ('wheelDeltaX' in e) {
wheelDeltaX = e.wheelDeltaX / 12;
wheelDeltaY = e.wheelDeltaY / 12;
} else if ('detail' in e) {
if (e.axis === 2) { // Vertical
wheelDeltaY = -e.detail * 3;
wheelDeltaX = 0;
} else { // Horizontal
wheelDeltaX = -e.detail * 3;
wheelDeltaY = 0;
}
} else {
wheelDeltaX = wheelDeltaY = -e.wheelDelta;
}
```