Stavros
Stavros

Reputation: 6110

How to call a function when the user uses the mouse wheel to scroll up/down in javascript

In HTML I have a table that is used as a grid. Now, I want to attach an event to this table, that when a scroll up/down is triggered, then my ScrollUp/ScrollDown function is called.

Upvotes: 8

Views: 1763

Answers (2)

Alex
Alex

Reputation: 6470

You need some JS Framework to simply your development and not reinvent the wheel.

Here is examples for Mootools

  1. http://demos.mootools.net/CustomEvents
  2. http://demos111.mootools.net/Mousewheel

And here for JQuery

  1. http://api.jquery.com/scroll/

Upvotes: 4

John Doherty
John Doherty

Reputation: 4095

If your looking for a cross browser, JavaScript framework independent version then this will do what you need

http://adomas.org/javascript-mouse-wheel/

Upvotes: 3

Related Questions