美文网首页
自定义动画

自定义动画

作者: 琪33 | 来源:发表于2018-04-26 16:19 被阅读0次
<style>
        div{
            position: absolute;
            left: 20px;
            top: 30px;
            width: 100px;
            height: 100px;
            background-color: pink;
        }
    </style>
    <script src="jquery-1.11.1.js"></script>
    <script>
        jQuery(function () {
            $("button").click(function () {
//                var json = {"width":500,"height":500,"left":300,"top": 300,"border-radius":100};
//                var json2 = {"width":100,"height":100,"left":100,"top": 100,"border-radius":100,"background-color":"red"};
//
//                //自定义动画
//                $("div").animate(json,1000, function () {
//                    $("div").animate(json2,1000, function () {
//                        alert("动画执行完毕!");
//                    });
//                });


//                //自定义动画
//                $("div").animate({"display":"none","opacity":0,"width":0,"height":0},2000);
//                $("div").animate({"height":0},2000);
//                $("div").animate({"opacity":0},2000);

            })
        })
    </script>
</head>
<body>
<button>动画</button>
<div></div>
</body>

相关文章

网友评论

      本文标题:自定义动画

      本文链接:https://www.haomeiwen.com/subject/bjkmlftx.html