开发者

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

开发者 https://www.devze.com 2023-01-15 17:23 出处:网络
In HTML I have a table that is used as a grid. Now, I wan开发者_如何转开发t to attach an event to this table, that when a scroll up/down is triggered, then my ScrollUp/ScrollDown function is called.Yo

In HTML I have a table that is used as a grid. Now, I wan开发者_如何转开发t to attach an event to this table, that when a scroll up/down is triggered, then my ScrollUp/ScrollDown function is called.


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/


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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消