View Full Version : mouse events and alternative methods of scrolling

04-13-2005, 07:47 AM
I've been working on a series of scripts for a DHTML content management system and have come across a pretty nasty snag in the way mouse events are not fired by the browser in certain scrolling instances.

I have a bunch of elements on a page, that perform an action when the mouse enters the element (onmouseover). I'm come to realize that when the mouse is within the content area of the page and you choose to scroll by using an alternative method to the scrollbars (such as the mouse wheel or arrow keys), mouse events won't fire because the mouse isn't moving, only the page underneath the mouse is. So, if by scrolling the page with arrow keys, my mouse pointer lands on top of one of these elements, the onmouseover event will not fire until I move the mouse at least one pixel.

Does anyone know of a work around for this issue?


04-13-2005, 08:44 AM
Yeah, from the onscroll event, determine pointer position from event properties, and compare that to element position, to call element.onmouseover(), when necessary.

The scrollTop property may be needed for the y-pos, by the way.