鼠标滚轮滚动事件 Chrome Firefox
2019-03-27 本文已影响0人
Micro同学
// 判断浏览器
let mousewheelevt=(/Firefox/i.test(navigator.userAgent))?"DOMMouseScroll": "mousewheel"
if (document.attachEvent) {
// 火狐
document.attachEvent("on"+mousewheelevt, (e) => {
// Balalalalala
})
} else if (document.addEventListener) {
document.addEventListener(mousewheelevt, (e) => {
// Balalalalalal
}, false)
}