faqts : Computers : Programming : Languages : JavaScript : Event handling

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

35 of 74 people (47%) answered Yes
Recently 1 of 10 people (10%) answered Yes

Entry

Is it possible to detect the use of a mouse scroll wheel with JavaScript??

Apr 15th, 2005 08:39
HeadCircus, Katharina Andresen,


wheel scroll is still just a scroll, so onscroll captures it.
window.onscroll = doThis;
function doThis(e){
//do
// e is the event
}
This url seems to indicate the html element support for this method:
http://www.blooberry.com/indexdot/html/tagpages/attributes/onscroll.htm
window is not listed, but if body has it, window has it as in the 
example above.
Just make sure to have no arguments in the function call. The event 
can be called if you want to capture that and do something with it, 
etc...