参考网址:点击打开链接
注册检测事件:
{
if (isIE) {
//alert(document.attachEvent);
document.attachEvent('onmousewheel', stopFunc); //IE < 9
//document.addEventListener('wheel', stopFunc, false); //IE >=9
} else {
window.addEventListener('wheel', stopFunc, false); //Firefox version
window.addEventListener('mousewheel',stopFunc, false); //safria chrome
}
}
删除检测事件:
{
if (isIE) {
document.detachEvent('onmousewheel', stopFunc);
}
window.removeEventListener('wheel', stopFunc, false); //Firefox
window.removeEventListener('mousewheel', stopFunc, false); //safria chrome
}
1.IE7-IE10上测试可用;
2.safria 5-safria 6上测试可用;
3.Firefox V21上测试可用;
4.Chrome Version 26.0.1410.43上测试可用;
这篇博客介绍了如何使用JavaScript来处理浏览器的鼠标滚轮事件,包括在不同浏览器环境下注册和删除事件监听器的方法,并提供了在IE7-IE10、Safari 5-6、Firefox V21及Chrome Version 26上的测试情况。
577

被折叠的 条评论
为什么被折叠?



