<div id="box" style="width:500px;height:300px;background-color:#ccc;overflow:auto;">
<div style="height:500px;"></div>
</div>
<script type="text/javascript">
var isFirefox = /Firefox/i.test(navigator.userAgent); //判断是不是火狐浏览器
var mwEvent = !isFirefox ? 'mousewheel' : 'DOMMouseScroll'; //是火狐浏览器用DOMMouseScroll
document.getElementById('box').addEventListener(mwEvent, function(event) {
console.dir(2);
});
</script>
mouseweel兼容火狐
最新推荐文章于 2021-12-15 09:33:47 发布