It looks like he's just mapping the mousewheel event to scrolling the area. In IE, this is really easy by just using the doScroll()
method - this will scroll the horizontal bar by the amount the vertical bar would normally scroll by. Other browsers don't support the doScroll()
method, so you have to live with scrolling by an arbitrary amount instead:
var mouseWheelEvt = function (event) {
if (document.body.doScroll)
document.body.doScroll(event.wheelDelta>0?"left":"right");
else if ((event.wheelDelta || event.detail) > 0)
document.body.scrollLeft -= 10;
else
document.body.scrollLeft += 10;
return false;
}
document.body.addEventListener("mousewheel", mouseWheelEvt);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…