yishuixs 2015-11-17 03:28 采纳率: 100%
浏览 3784
已采纳

jQuery自定义动画在中途停止后如何继续运动?

代码如下:

 <script src="../jQueryLibrary/jquery-1.11.3.js"></script>
<script>
        $(function(){
            $('button').eq(0).click(function(){
                $('#box').animate({
                    'left' : '800px'
                }, 4000).animate({
                    'top' : '400px'
                }, 3000).animate({
                    'left' : '0px',
                    'transform' : 'scale(1.5)'
                }, 4000);
            });
            $('button').eq(1).click(function(){
                $('#box').stop(true);
            });
        });
</script>
<style>
        #box{
            width:300px;
            height:300px;
            background:green;
            position:absolute;
        }
</style>

<body>
    <button type="button">start</button>
    <button type="button">stop(clearQueue)</button>
    <div id="box"></div>
</body>

我点击了start按钮之后,当div运动在第二个动画时,我点击了stop(clearQueue)按钮,动画停止,那么如何让动画继续运动下去?

  • 写回答

1条回答

  • Go 旅城通票 2015-11-17 03:58
    关注

    没有清除队列,再点一次start就行了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后的密码
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 UE5#if WITH_EDITOR导致打包的功能不可用
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题