...

View Full Version : Is it possible to have JavaScript triggered by Mouse Scroll Button?



Brett Bretterso
08-17-2005, 10:41 PM
I had an idea for making a page that would react to the use of a mouse's scroll button. I've seen it done in flash, but is it possible to do it in JavaScript? Does anyone know?

Brett Bretterson

Brett Bretterso
08-17-2005, 10:51 PM
My idea was to have a really big picture that by using the scroll button it would zoom in. That's what the Flash one I saw did, but instead of just having it be a cool picture I was thinking it would be a good system for looking at a map. That way you wouldn't have to click on a button to zoom in.

Brett Bretterson

martin_narg
08-17-2005, 11:31 PM
Hmm, there's no direct javascript handler for mouse scroll wheel scrolling, but if you were really clever you'd probably focus on an iframe or such with no borders or scrollbars and use that to set the javascript variables using the internal frame page scroll coordinates =)

Just an idea

m_n

glenmac
08-17-2005, 11:49 PM
For IE you can use onMouseWheel. check this link. http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/events/onmousewheel.asp

martin_narg
08-17-2005, 11:52 PM
Nice one :thumbsup:

Great shout, forgot about that.

m_n

Brett Bretterso
08-18-2005, 02:37 PM
Thanks a lot guys. I'll incorporate that. Since it only works in IE (curse you IE, Curse you!!!) I'm going to make it so holding the right mouse button and moving up and down controls the zoom, but I can make it so it checks if it's IE then also does the scroller if it is.

Anyway, thanks a lot.

Brett Bretterson



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum