标签:
function wheelFun(element,up,down){
element.onmousewheel = fn;
if (window.addEventListener) {
element.addEventListener("DOMMouseScroll",fn, false);
}
function fn(event){
var event = event || window.event;
if (event.wheelDelta > 0 || event.detail < 0) {
up();
} else{
down();
}
}
}
wheelFun(document,function(){
console.log(1);
},function(){
console.log(2);
});
标签:
原文地址:http://www.cnblogs.com/luckyXcc/p/5744533.html