我想对三种情况进行区分:
e.preventDefault(); if(Mousewheel.direction = Left) base.goForward(); else if(Mousewheel.direction = Right) base.goBack(); else{ //Doing normal slide但我找不到任何指示鼠标滚轮是水平还是垂直的东西,插件鼠标滚轮的唯一返回,即delta和event。
如果有人知道如何在水平和垂直方向上进行区分,感谢您分享您的提示。
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 slideBut 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确实是你的答案。
使用一些javascript调试工具,将断点放入事件处理程序并检查事件对象。
有一些有趣的属性,如event.originalEvent.wheelDeltaX和event.originalEvent.wheelDeltaY 。 我没有水平滚动鼠标来测试它,但这可能是你的解决方案。
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.
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.
更多推荐
发布评论