How can I make scrolling page scrolling trigger events?

When the mouse starts to hover over an element due to scrolling (either by using the wheel or by scrolling the keyboard), it does not trigger the mouseover event on the elements that it hangs (Chrome 6 on OSX). What would be the elegant way to fire the mouseover event for the right items when scrolling?

+7
javascript jquery jersey
source share
2 answers

Honestly, it will be a pain. You need

  • determine the size and position of each element that the mouseover handler should receive.
  • add to the scroll window.
  • In the handler, find the position of the mouse cursor and pageOffset.
  • Find out which element the cursor is in.
  • manually call the handler of the actual manipulator
  • (Find out what elements of the cursor remain if you also want some kind of mouse behavior)

You may need to recalculate the positions and sizes of the elements if they are dynamic. (move 1. below 3.)

Although this should work well with block-level elements, I have absolutely no idea about a solution for inline elements.

+4
source share

Try hacking like myDiv.style.opacity = 1+Math.random(); on the scroll;)

0
source share

All Articles