3

jQuery's mouseenter doesn't seem to fire when the mouse entered an element because of a scroll (i.e., as a result of scrolling).

Imagine the mouse pointer is currently not inside an element. Then you scroll using the scroll-wheel, resulting in the mouse pointer (which has not moved at all) being inside the element. jQuery will not fire the mouseenter callback. How can I get the mouseenter callback to fire in this case?

See http://mobdealio.com/131/?view=LIST&city=3 for an example. My idea is to update the map on the left when the user mouse's over a deal. But if the user scrolls using the scroll-wheel, then the map doesn't update (unless the user nudges the mouse a tiny bit).

Edit: I experience this issue in Chrome 15.0.874.121 m & Windows 7.

Sanjay
  • 1,691
  • 1
  • 15
  • 18
  • Not in chrome, though. I don't think there's anyway of doing it, apart from Adam's suggestion. – scumah Nov 21 '11 at 08:46

1 Answers1

2

The only thing i can think of is to detect when the document is scrolled with $(window).scroll, and then get the cursor position relative to the element (this question was asked here: jQuery get mouse position within an element) and if it is inside any of the elements then to change the map.

Community
  • 1
  • 1
Adam Merrifield
  • 10,307
  • 4
  • 41
  • 58
  • Thanks, dude. Sounds reasonable. I'll try this, and if it works, I'll mark this as the correct answer! – Sanjay Nov 21 '11 at 08:53