jQuery自定义动画animate

代码示例:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>24-jQuery自定义动画效果animate</title>
        <style type="text/css">
            div {
                height: 200px;
                width: 200px;
                background-color: pink;
                position: relative;
                left: 1000px;
                top: 2600px;
            }
        </style>
    </head>
    <body>
        <button>动起来</button>
        <div></div>
    </body>
    <script src="jquery-3.6.0.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
        $(function() {
            $("button").click(function() {
                $("div").animate({
                    left: 500,
                    top: 300,
                    opacity: 0.4,
                    width: 500
                }, 500)
            })
        })
    </script>
</html>

 

posted @ 2022-04-18 10:39  今天穿秋裤了吗  阅读(48)  评论(0)    收藏  举报