I have an absolutely-positioned div, and I\'m trying to keep track of when the mouse moves over it, and when the mouse leaves. Unfortunately clicking on the text in the box
var trackmouseup = null;
$('.box').mouseup(function(event){
if(trackmouseup){
clearTimeout(trackmouseup);
}
trackmouseup = setTimeout(function(){
trackmouseup = null;
}, 2); //it must be 2ms or more
});
$('.box').mouseleave(function(event){
//if this event is triggered by click, there must be a mouse up event triggered 2ms ago
if(trackmouseup){
return;
}
//to do something
});