标签:
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.x
if(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);
}
标签:
原文地址:http://my.oschina.net/u/1992917/blog/399400