views:

360

answers:

1

Hi,

I've attached a function to the DOMMouseScroll event in FF3.5. The event fires as expected on a vertical scroll, but not on a horizontal scroll. Is this a known bug or a problem with my code?

document.addEventListener('DOMMouseScroll', function() {
    console.log(arguments);
}, false);

Rich

+1  A: 

Looks like there is a related defect, but it's supposed to be fixed in 3.5. How are you triggering the vertical scroll, it seems from that defect that you need a touchpad to even trigger the event described? If you're not specifically after mousewheel events you could try the onscroll event instead, this works in FF3.5:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;&lt;html dir="ltr" lang="en">
<html>
    <head>
    <style type="text/css">
    body {
        width: 2000px;
    }
    </style>
    </head>
    <body onscroll="console.log('Scrolled!')">
        <p style="height: 2000px;">test</p>
    </body>
</html>
robertc
That has answered my question with respect to actually firing an event on horizontal scroll, but it is specifically the horizontal mouse wheel that I'm after. It was my understanding that DOMMouseScroll supports this as of FF 3.5. Google Docs have managed detect horizontal mouse scroll across FF, Safari and Chrome.
kim3er