Jquery queueing animations

前端 未结 4 367
佛祖请我去吃肉
佛祖请我去吃肉 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 20:22

    I'm not sure why you don't want to use the method you described. If its purely from an organizational standpoint you don't have to use anonymous functions

    function showFirst() {
      $('#first').show(800, showSecond);
    }
    
    function showSecond() {
      $('#second').show(800, showThird);
    }
    
    function showThird() {
      $('#third').show(800);
    }
    
    function startAnimation() {
      showFirst();
    }
    

提交回复
热议问题