Joe.wang
Joe.wang

Reputation: 11793

Mouseenter and MouseLeave trigger at the same time

I know the usage of mouseenter and mouseleave. Below is my code sample:

$('div').mouseenter(function(e){
   ...
}).mouseleave( function(e){
   ...
   //let say it will take 5 second. 
});

But my question is, is it possible that two handlers are triggered at the same time if I move the mouse quickly? I mean mouseleave doesn't finish , meanwhile mouseenter is triggered because the mouse just moved in.

Updated

In my example, what I mean is if the mouse move in 3 seconds after mouseleave has been triggered, will it also trigger mouseenter? If it does, does it mean the same DOM element trigger mouseenter and leave at the same time? Thanks.

Upvotes: 2

Views: 1984

Answers (2)

Adil
Adil

Reputation: 148110

It is not possible to trigger both event at the same time. As javasript is not multi-threaded. If you want to put some delay between execution you can use setTimeout

Upvotes: 2

bipen
bipen

Reputation: 36531

no ....there is no possibbilities of calling both the function at same time.... and you can't be quick enough for that

Upvotes: 0

Related Questions