I tried to override Chrome's mouse wheel event with this code:
// Wheel handler
function wheel(event){
var ret = true;
if (event.wheelDelta) {
// Tilt to the left
if (event.wheelDeltaX > 0) {
alert('Left');
//window.history.back();
ret = false;
}
// Tilt to the right
if (event.wheelDeltaX < 0) {
alert('Right');
//window.history.forward();
ret = false;
}
}
event.returnValue = ret;
}
// Bind the onmousewheel event to our handler
window.onmousewheel = document.onmousewheel = wheel;
But it seems that when I tilt left/right, nothing happens. What's wrong with this userscript? Thanks.