鼠标滚动事件

来源:互联网 发布:2017最新潮网络词 编辑:程序博客网 时间:2024/04/28 12:13

非火狐:onmousewheel -> wheelDelta (返回的总是120的倍数,120表明鼠标向上滚动,-120表明鼠标向下滚动)。

火狐:DOMMouseScroll -> detail (返回的总是3的倍数,3表明鼠标向下运动,-3表明鼠标向上运动)。

兼容写法:var mousewheelevt=(/Firefox/i.test(navigator.userAgent))?"DOMMouseScroll":"mousewheel"。

原创粉丝点击