How to delay jquery animation?

前端 未结 2 896
故里飘歌
故里飘歌 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:02

    You can do it like this:

    setTimeout(function() {
      $("#microcharcounter").show();
    }, 20000);
    

    The problem with .delay() and .show() (without a duration), is that .show() isn't an animation, it's an immediate effect that's not on the fx queue at all. You could however give it a duration, like this:

    $("#microcharcounter").delay(20000).show("fast");
    

提交回复
热议问题