Jquery queueing animations

前端 未结 4 346
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 19:35

I have several animations that I want to perform on different objects in the dom.

I want them to occur in order.

I do not want to do it like this:

         


        
4条回答
  •  有刺的猬
    2020-12-09 19:57

    I've just used this plugin, http://plugins.jquery.com/project/timers, the other day to do a similar thing. Your basically iterating through all the matched dom elements and then performing an animation each one when the index * your millisecond count.

    The code was something like this:

    HTML:

    These
    Show
    In
    Order

    jQuery

    $("#wrapper div").foreach( function(i) {
        i = i + 1;
        $(this).oneTime(800 * i, "show", function()  {
            $(this).show();
        });
    });
    

提交回复
热议问题