Is there any way to make it so if a user hovers on a link for 2 seconds, then the jQuery is execu开发者_JS百科ted?
Thanks in Advance!
var t;
$("#foo").hover(
function() {
t = setTimeout(function() {
alert("hover");
}, 2000);
},
function() {
clearTimeout(t);
}
);
You can try the hoverIntent plugin.
Well if you use a more recent version of jquery you could simple use the delay function
精彩评论