Delay a link click

后端 未结 8 2297
醉梦人生
醉梦人生 2020-12-18 12:57

Here\'s the fiddle I\'m working with: http://jsfiddle.net/Scd9b/

How can I delay the href function after the click?

For example a user clicks on the link, th

8条回答
  •  温柔的废话
    2020-12-18 13:14

    This should do it:

    $("a[href]").click(function () {
        var url = this.href;
        setTimeout(function () {
            location.href = url;
        }, 2000);
        return false;
    });
    

提交回复
热议问题