What is the most neatest way to check whether a user is hovering over an object after hovering out of a different object. I.e. If user mouses out of object A onto object B, how would you suggest I go about monitoring this? I don't really like the idea of continously monitoring the mouses position when it moves, though it may be the only option...
Asked
Active
Viewed 2,444 times
0
-
Add a hover event to object B? – gen_Eric Oct 12 '12 at 14:39
2 Answers
2
check out this fiddle
A simple hover event in jQuery can accomplish this, with the help of some variable work, you can store what the previous element and current element are.

Dennis Martinez
- 6,344
- 11
- 50
- 67
1
Events bubble up. Add en event listener for the parent element of A & B. In that listener you can record on mouseout the original target of the event as the latest object that was mousedout (using something like $(this).data("latestMouseout",latestTarget), Best way to get the Original Target). On mousein, you can check your conditions and see if latest mouseout target and mousein target meet the conditions you need.
I know this is a little vague, but so is your question. If this helps great. If not, feel free to ask clarifying questions.