JQuery synchronous animation

前端 未结 7 1924
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-29 07:00

In many cases I wish animation to be executed synchronously. Especially when I wish to make a a series of sequential animations.

Is there an easy way to make a jQuer

相关标签:
7条回答
  • 2020-11-29 07:29

    I agree with @SLaks on this one. You should be using jQuery's callbacks for given animations to create your synchronous animation. You can essentially take whatever you have for your current animation and split it up like so:

    $yourClass = $('.yourClass');
    $yourClass.animate({
        width: "70%"
    }, 'slow', null, function() {
        $yourClass.animate({
            opacity: 0.4
        }, 'slow', null, function() {
            $yourClass.animate({
                borderWidth: "10px"
            });
        });
    });
    
    0 讨论(0)
提交回复
热议问题