Mousewheel scrolling event in Mozilla

Did you know that Mozilla doesn’t fire the scroll event when you scroll a page with the mousewheel? Pretty annoying, that. However, I have just discovered that it does fire the DOMMouseScroll event. So, if you’re annoyed that using the mouse wheel doesn’t give you a scroll event, trap the DOMMouseScroll event instead, with window.addEventListener('DOMMouseScroll', scroll_function, false). Quite why this inconsistency exists escapes me a bit, but now there’s a solution.

8 Responses to “Mousewheel scrolling event in Mozilla”

  1. Tip: In Mozilla, never put the beer at the bottom of the page and reply on the ’scroll’ event to get there.
    Thanks Stuart :)

    Dustin Diaz
  2. *rely - not reply ;)

    Dustin Diaz
  3. [...] There are times when this weblog is silent because I’m not up to much. There are also times when it’s silent because I’m up to too much and don’t have time to post. This most recent silence has been the latter sort, although a couple of nuggets (like the thing about mousewheel scrolling and the thing about defineSetters came out of my current work. Still not ready to reveal it, but I do have one other thing to say: I’m going to SxSW 2006! Yes indeed. I shall be there in Austin. I got well sick last year of everyone going on about it, and Simon ragged on me for thinking about not going, pointing out that it is great and fantastic and now he works at Yahoo, and I examined his argument and found it compelling. We’ll ignore, for the moment, all the 64oz steaks for $0.99 that you get in Texas, although I shall not be ignoring them when I get there, no sirree. Bring me another. And another plate of chips, too. Oh yes. Anyway, I’m really looking forward to it. It’s going to be cool. I’m also speaking at a couple of upcoming conferences; details when they go public. Blimey — jetting off to other countries, speaking at conferences…I’m turning into Jono. Heh. [...]

    as days pass by » Off to Austin
  4. Tnx a lot, you saved me some agony.

    Zs
  5. Thank you!!! It’s that I want!

    Rom@nych
  6. Ahhhh! This has been a pain for such a long time! Thank you :)

    GôTô
  7. Saved me too!
    Thank you for sharing with all!

    Leena Kulkarni
  8. Thanks, this just answered my question very well. Note, though, that FF 2.0 uses the scroll event like everybody else. This tip still applies for FF1.5.

    Tom

    Tom Lancaster

Leave a Reply