<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div {
position: absolute;
width: 100px;
height: 100px;
background-color: pink;
}
</style>
<script src="jquery-3.4.1.js"></script>
<script>
$(function () {
$("button").click(function () {
// jquery 是不支持 background-color 进行动画的,可以去 w3c 等相关网站上查询支持属性
// var json = {'width':500, 'height':500, 'left':300, 'top':100, '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 () {
// console.log("动画执行完毕");
// });
// });
$('div').animate({'display': 'none', 'opacity': 0, 'width': 0, 'height': 0}, 2000)
})
})
</script>
</head>
<body>
<button>动画</button>
<div></div>
</body>
</html>