jq stop(停止动画)

来源:互联网 发布:淘宝有暗号 编辑:程序博客网 时间:2024/06/05 09:42

点击打开链接

<body>
        <input type="button" name="" id="" value="停止" />
        <div class="box"></div>
    </body>
    <script src="js/js/jquery-1.12.4.min.js"></script>
    <script src="js/js/jquery.easing.1.3.js"></script>
    <script>
        $($('.box')[0]).on('mouseover',function(){
            $(this).animate({width:600,height:600},5000,function(){
                $(this).animate({width:100,height:100},5000);
            });
        });
        $('input').on('click',function(){

            //效果等同于$($('.box')[0]).stop(false,false);
            //$($('.box')[0]).stop();
            
            //正在播放的动画立即停止,播放下一个动画
            //$($('.box')[0]).stop(false,false);
            
            //清空了后续动画,不会再做播放
            //$($('.box')[0]).stop(true,false);
            
            //立即执行完成当前动画(变成最终值),再继续执行后面的动画
            //$($('.box')[0]).stop(false,true);
            
            //立即变成最终状态,没有后续的动画执行
            //$($('.box')[0]).stop(true,true);
        });

    </script>