I have a menu link, that when hovered, shows a div#options under it. The issue is that I want to hide #options again when the mouse leaves it, but also if when it leaves the link element.
I thought the best way to do this was: on the link's hover-out function, see if the cursor is on top of #options, if it is, return false, else proceed to hiding it again.
Something like this
$('#menu-link').hover(function() {
$('#options').slideDown()
}, function() {
// Perhaps only do this if mouse is NOT on top of #options?
$('#options').slideUp()
});
But how can I detect which element the cursor is on?
or even, is there a better way of doing this?
very simple jsfiddle describing this is here: http://jsfiddle.net/N6kwn/5/