问题描述
我想区分三种情况:
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.
推荐答案
更新:我用笔记本电脑垫对其进行了测试,而event.originalEvent.wheelDeltaX
确实是您的答案.
UPDATE: I tested it with my laptops pad and event.originalEvent.wheelDeltaX
is indeed your answer.
使用一些javascript调试工具,在事件处理程序中放置一个断点并检查事件对象.
Using some javascript debugging tools, place a breakpoint into the event handler and examine the event object.
那里有一些有趣的属性,例如event.originalEvent.wheelDeltaX
和event.originalEvent.wheelDeltaY
.我没有水平滚动鼠标来测试它,但是可能这是您的解决方案.
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.
这篇关于检测水平鼠标滚轮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!