日期:2014-05-16 浏览次数:20368 次
function preventDefault(e){
if(e.preventDefault){
e.preventDefault();
}else{
e.returnValue = false;
}
}
function mousewheel(e){
e = e
------解决方案--------------------
window.event;
preventDefault(e);
var speed = e.wheelDelta
------解决方案--------------------
-e.detail;
scrollLeft = Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
scrollLeft -= speed;
document.documentElement.scrollLeft = document.body.scrollLeft = scrollLeft;
}
function addEvent(node,type,callback){
if(!node){return;}
if(node.addEventListener){
node.addEventListener(type,callback,false);
}else if(node.attachEvent){
node.attachEvent("on"+type,callback);
}else{
node["on"+type] = callback;
}
}
addEvent(document,"mousewheel",mousewheel);
addEvent(document,"DOMMouseScroll",mousewheel);