Skip to content Skip to sidebar Skip to footer

Disable Browser Scrolling With The Middle Mouse Scroll Button

I have a flash element on my page that you interact with by using the middle mouse scroll wheel. The page is long. So when scrolling with the mouse wheel it interacts with the Flas

Solution 1:

<!-- disables browser mouse scrolling --><scripttype="text/javascript">if(window.addEventListener){
    window.addEventListener('DOMMouseScroll',wheel,false);
}

functionwheel(event)
{
    event.preventDefault();
    event.returnValue=false;
}
window.onmousewheel=document.onmousewheel=wheel;
</script>

I have "extracted" this function from the Flash MouseWheelTrap which can be found here: http://code.google.com/p/mousewheeltrap/

Solution 2:

You can use:

document.body.style.overflow=allowScroll?"":"hidden";

Where allowScroll is a boolean.

Solution 3:

window.onscroll = function() {
    document.body.scrollTop = 0;
}

Solution 4:

SWFWheel: http://www.libspark.org/wiki/SWFWheel/en

Post a Comment for "Disable Browser Scrolling With The Middle Mouse Scroll Button"