Search code examples
jqueryhovermouseoverdelay

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 executed?

Thanks in Advance!


Solution

  • var t;
    $("#foo").hover(
        function() {
            t = setTimeout(function() {
                alert("hover");
            }, 2000);
        },
        function() {
            clearTimeout(t);
        }
    );