I need to know how I can stop my mouseleave event from occuring when I slide my mouse over to a different element (link). How can I setup a condition that says to only do the mouseleave animation if I have not entered a specific element?
$(activity_link).mouseenter(function() {
$(this).siblings(".delete_place").animate({
"left" : "-28px"
}, 300);
}).mouseleave(function() {
$(this).siblings(".delete_place").animate({
"left" : 0
}, 300);
});
Use of event relatedTarget:
$(activity_link).mouseenter(function () {
$(this).siblings(".delete_place").animate({
"left": "-28px"
}, 300);
}).mouseleave(function (e) {
if (e.relatedTarget != myElem) { //where myElem is a HTML element
$(this).siblings(".delete_place").animate({
"left": 0
}, 300);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With