Delay a link click

后端 未结 8 2315
醉梦人生
醉梦人生 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:31

    $(document).ready(function(){
    
        $("span.answer").hide();
    
        $("a.question").click(function(e){
            e.preventDefault();
            $(this).toggleClass("active").next().slideToggle("slow");
            var Link = $(this).attr("href");
            setTimeout(function()
            {
                 window.location.href = Link;
            },2000);
        });
    
    });
    

提交回复
热议问题