• jQuery-stop方法停止所有在指定元素上正在运行的动画


    1.stop()方法解析

    • 停止所有在指定元素上正在运行的动画
    • stop(clearQueue,gotoEnd)
    • 这个两个参数可选值是布尔值
    • stop(flase,flase):不请空动画队列,不立即跳到动画最后
    • stop(true,true):请空动画队列,立即跳到动画最后
    • stop(flase,true):不请空动画队列,立即跳到动画最后
    • stop(true,flase):请空动画队列,不立即跳到动画最后

    2.代码如下

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>stop用法</title>
        <style>
            #box {
                 100px;
                height: 100px;
                position: absolute;
                top: 50px;
                left: 50px;
                border: 1px solid #000;
            }
        </style>
    </head>
    
    
    <body>
        <button id="btn1">stop(false,false)</button>
        <button id="btn2">stop(true,true)</button>
        <button id="btn3">stop(false,true)</button>
        <button id="btn4">stop(true,false)</button>
        <div id="box"></div>
        <script src=" https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js"></script>
        <script>
            var box = $("#box")
            box.animate({
                left: 300
            }, 1000)
            box.animate({
                top: 300
            }, 1000)
            box.animate({
                left: 50
            }, 1000)
            box.animate({
                    top: 50
                }, 1000)
                //stop(flase,flase):不请空动画队列,不立即跳到动画最后
            $("#btn1").click(function() {
                    box.stop(false, false)
                })
                // stop(true,true):请空动画队列,立即跳到动画最后
            $("#btn2").click(function() {
                    box.stop(true, true)
                })
                // stop(flase,true):不请空动画队列,立即跳到动画最后
            $("#btn3").click(function() {
                    box.stop(false, true)
                })
                // stop(true,flase):请空动画队列,不立即跳到动画最后
            $("#btn4").click(function() {
                box.stop(true, false)
            })
        </script>
    </body>
    
    </html>
  • 相关阅读:
    第四周:卷积神经网络 part3
    第四周作业:卷积神经网络学习part3
    视频学习--《 图像语义分割前沿进展》
    视频学习--《语义分割中的自注意力机制和低秩重建》
    第二次作业:卷积神经网络 part 1
    使用VGG模型迁移学习进行猫狗大战
    使用 VGG16 对 CIFAR10 分类
    CIFAR10 数据集分类
    MNIST数据集分类
    第一次作业:深度学习基础
  • 原文地址:https://www.cnblogs.com/dongxuelove/p/12933765.html
Copyright © 2020-2023  润新知