Two years ago I did a piece of research for a journal's especial edition. I got the reviewer's comments, did all the corrections and sent it to my co-authors. One of them took so long to return his comments that the paper wasn't included in the EE. I then tried to submit it to another journal but again the same co-author took long time to provide his comments. Finally my boss suggested me to submit it to another journal (good one) without waiting for my co-author's opinion. I got the reviewer's comments back, I did all the corrections (I have 45 days), sent it to my co-authors and gave them a week to send me their comments. The same co-author is now telling me he's not happy I didn't tell him I submitted to that journal and that he won't be able to make comments in a week. I'm again in a catch-22. What do you do?


Question: jQuery/JS setTimeout/clearTimeout
Answer: Bind both mouseenter and mouseleave. You'll want to do the timeout on the mouseleave, but then reset it when/if the mouseenter happens again.

Try looking at just the selected answer here to see how to do what I'm talking about.

Something like this:

var timeout;
$("#services_link, #vendors_dropdown").mouseenter(function() {
    window.clearTimeout(timeout);
    $("#services_link").css('background-position','left -73px');
    $("#vendors_dropdown").slideDown();
}).mouseleave(function(){
    timeout = window.setTimeout(HideMe, 4000);
});

function HideMe() {
    $("#services_link").css('background-position','left 0');
    $("#vendors_dropdown").slideUp();
}