Calling a function when neither of two elements is being hovered?
<p>My idea is to have two variables, insideLink that marks if I'm currently hovering over my menu and insideBox that checks if I'm hovering over Div container.</p>

<p>And if I leave I check if I'm also out of the other element, if I'm out of both I call the closeboth function that closes them both.</p>

<p>I tried doing it like this, but it doesn't work. Box closes right away after I move away from the menu link.</p>

<p>I suppose setTimeout would help but, but my attempts with that didn't work quite well. Any ideas? </p>

 <pre class="lang-js prettyprint-override"><code>$(linkID).hover(function() {
    insideLink=1;
    console.log("Its over Link");
},function() {
    insideLink=0;
    if (insideBox==0) {
      console.log("Its outside both elements, closebox"); 
      closebox();
    }
});

$(open).hover(function() {
    insideBox=1;
    console.log("Its inside box");
},function() {
    insideBox=0;
    if (insideLink==0) {
      console.log("Its outside both elements, closebox");
      closebox();
    }
});
</code></pre>
