开发者

Adjust jQuery mouseover Sensitivity

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜