jQuery fade out then fade in

前端 未结 4 641
失恋的感觉
失恋的感觉 2020-12-08 07:08

There\'s a bunch on this topic, but I havn\'t found an instance that applies well to my situation.

Fade a picture out and then fade another picture in. Instead, I\'m

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 07:34

    With async functions and promises, it now can work as simply as this:

    async function foobar() {
      await $("#example").fadeOut().promise();
      doSomethingElse();
      await $("#example").fadeIn().promise();
    }
    

提交回复
热议问题