Using jQuery.queue with multiple element animations?

前端 未结 3 1567
孤城傲影
孤城傲影 2020-12-15 02:25

jQuery queue\'s are very annoying - I can\'t get my head around it...

The following function contains 4 animations which I want to happen one after the other (not at

3条回答
  •  时光取名叫无心
    2020-12-15 02:36

    Try using jQuery promise API. You can pull the promise from each jQuery element and then attach a done callback to it.

    For example,

    $("#header").animate({"opacity":"1"},{duration:3000 }).promise().done(function () {
        $("#header").animate({ "top":"0px" },{ duration:3000 });
    });
    

    You can refer to jQuery's promise API for more information. http://api.jquery.com/promise/

提交回复
热议问题