标签:
wheel(function(isTrue){
console.log(isTrue);
})
function wheel(callback){
if(navigator.userAgent.indexOf(‘Firefox‘)==-1){
if(document.attachEvent){
document.attachEvent(‘onmousewheel‘,fn);
}else{
document.addEventListener(‘mousewheel‘,fn);
}
}else{
document.addEventListener(‘DOMMouseScroll‘,fn)
}
function fn(ev){
var oEvent = ev || event;
if(oEvent.wheelDelta){
if(oEvent.wheelDelta>=120){
callback && callback(true);
}else{
callback && callback(false);
}
}else{
if(oEvent.detail>=3){
callback && callback(true);
}else{
callback && callback(false);
}
}
}
};
标签:
原文地址:http://www.cnblogs.com/pssp/p/5592324.html