jQuery delay to work with append()

前端 未结 3 2131
眼角桃花
眼角桃花 2021-02-15 12:10

I can\'t make the delay function of jQuery works with append function. What is wrong? Is there a way to make it work? I want to avoid using setTimeout

3条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-15 12:53

    delay() is a tricky function that can't be use with anything : it's mainly made for effects (it returns immediately, it doesn't block the javascript execution flow).

    From the doc :

    It can be used with the standard effects queue or with a custom queue

    (so you have to use a custom queue if you're not using the fx queue)

    Use setTimeout in this case.

提交回复
热议问题