Finish one animation then start the other one

后端 未结 8 2096
谎友^
谎友^ 2020-12-03 11:11

I have two divs and two separate links that triggers slideDown and slideUp for the divs.

When one of the divs are slided down and I click the other one, I hide the f

8条回答
  •  庸人自扰
    2020-12-03 11:44

    You should chain it like this

    function animationStep1()
    {
       $('#yourDiv1').slideUp('normal', animationStep2);
    }
    
    function animationStep2()
    {
       $('#yourDiv2').slideDown('normal', animationStep3);
    }
    
    // etc
    

    Of course you can spice this up with recursive functions, arrays holding animation queues, etc., according to your needs.

提交回复
热议问题