var wrap = document.querySelector("#wrap");
if(wrap.addEventListener){
wrap.addEventListener("DOMMouseScroll",fn);
}
wrap.onmousewheel=fn;
function fn(ev){
ev = ev||event;
var stat = "";
//非火狐浏览器
if(ev.detail){
stat = ev.detail<0?"up":"down";
}
//火狐浏览器
if(ev.wheelDalta){
stat = ev.wheelDalta>0?"up":"down";
}
switch(stat){
case "up":
//滚轮往上滑
break;
case "down":
//滚轮往下滑
break;
}
/*
if(ev.preventDefault){ //禁用事件的默认行为dom2
ev.preventDefault();
}
return false; //禁用事件的默认行为dom0
*/
}