windowAddMouseWheel() {
let that = this
let scrollFunc = function (e) {
e = e || window.event
if (e.wheelDelta) { //判断浏览器IE,谷歌滑轮事件
if (e.wheelDelta !== 0) { //当滑轮滚动时
that.visible = false
}
} else if (e.detail) { //Firefox滑轮事件
if (e.detail !== 0) { //当滑轮滚动时
that.visible = false
}
}
}
//给页面绑定滑轮滚动事件
if (document.addEventListener) {
document.addEventListener('DOMMouseScroll', scrollFunc, false)
}
//滚动滑轮触发scrollFunc方法
window.onmousewheel = document.onmousewheel = scrollFunc
},
判断鼠标滑轮滚动事件
猜你喜欢
转载自blog.csdn.net/WmingCSDN/article/details/86657667
今日推荐
周排行