标签:use attach 谷歌 down als esc pre var 滚轮
function mouseWheel(obj,upfun,downfun){
if(obj.attachEvent){
obj.attachEvent("onmousewheel",fun,false);//IE
}else if(obj.addEventListener){
obj.addEventListener("mousewheel",fun,false);//谷歌
obj.addEventListener("DOMMouseScroll",fun,false);//火狐
}
function fun(e){
var ev=e||window.event;
var num=ev.detail||ev.wheelDelta;
if(num==-3||num==120){
upfun()
}else if(num==3||num==-120){
downfun();
}
}
}
标签:use attach 谷歌 down als esc pre var 滚轮
原文地址:http://www.cnblogs.com/jinxin-school/p/6921202.html