Html code
<div id="a"></div>
<div id="b"></div>
<div id="box"></div>
How can i check if the mouse is not over #a & #b and then run the function
$("#a").mouseleave(function () {
$("#box").fadeOut(800));
});
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to keep a “cache” of whether the mouse is in A or B, and finally you need to check whether both are in the “out” state and then run your
fadeOutfunction. A word of warning, allow the user a few milliseconds to transition from one to the next, otherwise you’ll find it doesnt work as expected.This code should do it, with a live example here: http://jsfiddle.net/jzCjD/