animate动画回调函数

对非动画的实现排队,比如这个css()是要放在回调函数里才能,让前面的动画执行完成后在进行实现

 $('button').click(function(event) {
            $(this).next().animate({'left':'300px','height':'100px'},3000)
                          .animate({'top':'200px','width':'100px'},3000,function(){
                            $(this).css('background','red');
                          })
        });
        // $('button').trigger('click');  自动执行函数

 html

    <button>点击执行</button>
        <div>
            动画排队
        </div>

css

*{margin: 0; padding: 0;list-style: none;}   
div{ 300px;height: 200px;background-color:pink;margin:20px;text-align: center;line-height: 200px;position:absolute;}
button{margin:50px;}
原文地址:https://www.cnblogs.com/Model-Zachary/p/6297297.html