zoukankan      html  css  js  c++  java
  • 211 jQuery 自定义动画:animate()

    自定义动画非常强大,通过参数的传递可以模拟以上所有动画,方法为:animate() ;

    ​ 语法规范如下:

    代码演示

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script src="jquery.min.js"></script>
        <style>
            div {
                position: absolute;
                 200px;
                height: 200px;
                background-color: pink;
            }
        </style>
    </head>
    
    <body>
        <button>动起来</button>
        <div></div>
        <script>
            $(function() {
                $("button").click(function() {
                    // 可以把第一个参数提出来,用对象保存
                    $("div").animate({
                        left: 500,
                        top: 300,
                        opacity: .4,
                         500
                    }, 500);
                })
            })
        </script>
    </body>
    
    </html>
    

  • 相关阅读:
    wkhtmktopdf
    linux命令行抓取网页快照
    ubuntu 固定静态IP
    $http questions
    generate_scripts
    network
    IT_Qestion
    day03
    day02
    day01
  • 原文地址:https://www.cnblogs.com/jianjie/p/12203414.html
Copyright © 2011-2022 走看看