How to delay jquery animation?

前端 未结 2 895
故里飘歌
故里飘歌 2020-12-03 03:13

I can\'t seem to delay the showing of a div. I want to delay the animation by about 20 seconds is this possible???

$(\"#microcharcounter\").delay(10000).show         


        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 04:07

    Try this:

    $("#microcharcounter").delay(10000).show(0);
    

    or this:

    $("#microcharcounter").delay(10000).queue(function(n) {
        $(this).show();
        n();
    });
    

    The reason for this is that .delay() will only delay items in an animation queue. So you can make .show() a short animation by adding a duration of '0', or add it to the queue with .queue().

提交回复
热议问题