function handler(e){ //这里必须加参数e,否则firefox不兼容 e = e ? e : window.event; if(document.addEventListener){ e.preventDefault(); }else{ e.returnValue = false; }}var mousewheelevt=(/Firefox/i.test(navigator.userAgent))?"DOMMouseScroll": "mousewheel"//FF doesn‘t recognize mousewheel as of FF3.xif(document.attachEvent){//if IE (and Opera depending on user setting) document.attachEvent("on"+mousewheelevt, handler);}else if(document.addEventListener){ //WC3 browsers document.addEventListener(mousewheelevt, handler, false);}
时间: 2024-10-04 06:08:16