Skip to content
This repository has been archived by the owner on Mar 27, 2019. It is now read-only.

Direction with mousewheel #652

Closed
izifortune opened this issue Mar 21, 2014 · 5 comments
Closed

Direction with mousewheel #652

izifortune opened this issue Mar 21, 2014 · 5 comments

Comments

@izifortune
Copy link

Hello, i was wondering why directionX and directionY seems not to work when using the mousewheel, they work only if you click/tap on the list.
If this is the default behaviour there's a way to get the direction of the scroll when using the mousewheel?

@BowlingX
Copy link

same issue here...

@trakout
Copy link

trakout commented Mar 16, 2015

+1, same issue. Using iscroll-probe v5.1.3.

@trakout
Copy link

trakout commented Mar 16, 2015

Update: Solved it. Inside the _wheel: function (e) { function, below the following lines:

newX = this.x + Math.round(this.hasHorizontalScroll ? wheelDeltaX : 0);
newY = this.y + Math.round(this.hasVerticalScroll ? wheelDeltaY : 0);

..insert the following two lines:

this.directionX = wheelDeltaX > 0 ? -1 : wheelDeltaX < 0 ? 1 : 0;
this.directionY = wheelDeltaY > 0 ? -1 : wheelDeltaY < 0 ? 1 : 0;

..Not too sure if this creates any conflicts or hits on performance, but so far so good.

@jonathanheilmann
Copy link

+1 for this solution

@sculove
Copy link
Collaborator

sculove commented Mar 28, 2016

I merged. thank you very much.

@sculove sculove closed this as completed Mar 28, 2016
aisouard pushed a commit to Mappy/iscroll that referenced this issue Feb 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants