Reputation: 10643
i have a hover event attached to a few links and when you go over it a box appears.
Is there a way that i can make the hover event only trigger if the mouse has been over the link for more then 500 ms? So currently as soon as the mouse goes over the link the box appears but i want it to only appear if the mouse has been over the box for 500 ms or longer.
Upvotes: 3
Views: 9088
Reputation: 2937
Here's a great jQuery plugin that helps you decide if the mouse movement is appropriate for initiating an action. It is called hoverIntent
Upvotes: 2
Reputation: 3044
var myTimeout;
$('#mylink').mouseenter(function() {
myTimeout = setTimeout(function() {
//do stuff
}, 500);
}).mouseleave(function() {
clearTimeout(myTimeout);
});
Upvotes: 18