开发者

Adjust jQuery mouseover Sensitivity

开发者 https://www.devze.com 2023-01-31 03:24 出处:网络
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?

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

精彩评论

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