标签:
function mousewheel(obj,succFn){ if (window.navigator.userAgent.indexOf("Firefox")!=-1){ obj.addEventListener("DOMMouseScroll", fn, false); }else{ obj.onmousewheel=fn; } function fn(e){ var e=e||window.event; var down=true; if (e.detail){ //火狐 down=e.detail>0; }else{ //谷歌,ie down=e.wheelDelta<0; } succFn(obj,e,down); if (e.preventDefaul){ e.preventDefault(); } return false; } }
调用:
mousewheel(obj,function(e,down){});
标签:
原文地址:http://www.cnblogs.com/pan-hello/p/4562980.html