I have a set of list elements (<li>
within a <ul>
) laid out as bubbles on a chart like this, where the bubbles are the <li>
elements:
http://i.stack.imgur.com/PR7vR.png
I want to be able to detect the difference between
I've attempted to use $(this)
in the .mouseleave()
even for a bubble, but it registers the element that you're leaving rather than the element that you're currently hovering.
Any ideas on how to get the element that the mouse is moving onto upon mouseleave()
?
You need to use event.toElement || e.relatedTarget
:
$('li').mouseleave(function(e)
{
// new element is: e.toElement || e.relatedTarget
});
(Edited to note || e.relatedTarget
to ensure browser compatibility)