5

I would like to make a differenciation between three cases :

e.preventDefault();
if(Mousewheel.direction = Left)
    base.goForward();
else if(Mousewheel.direction = Right)
    base.goBack();
else{   
    //Doing normal slide                            

But I can't find anything indicating if the mousewheel is horizontal or vertical, the only returns of the plugin Mousewheel, being delta and event.

If someone knows how i could make a differenciation between horizontal and vertical wheeling, thanks for sharing your tips.

skolima
  • 31,963
  • 27
  • 115
  • 151
Thoma Biguères
  • 1,136
  • 4
  • 18
  • 42

3 Answers3

8

UPDATE: I tested it with my laptops pad and event.originalEvent.wheelDeltaX is indeed your answer.

Using some javascript debugging tools, place a breakpoint into the event handler and examine the event object.

enter image description here

There are some interesting properties there like event.originalEvent.wheelDeltaX and event.originalEvent.wheelDeltaY. I don't have a mouse with horizontal scrolling to test it but possibly this is your solution.

lalibi
  • 3,057
  • 3
  • 33
  • 41
0

You can do this in IE9, IE10, Firefox, Safari and Chrome. The different browsers currently each have a different event you need to register (although they will all eventually converge upon the new W3C standard onwheel event).

In another answer I put a bunch of detail about detecting x-axis scrolling.

Community
  • 1
  • 1
robocat
  • 5,293
  • 48
  • 65
0

Most scrollwheel drivers have an option that changes vertical scrolling to horizontal when the shift key is held down. Try detecting that instead.

Blazemonger
  • 90,923
  • 26
  • 142
  • 180