animate(params,[speed],[easing],[fn] )
params:想要更改的样式属性 必须写 (上右下左/宽高/透明度
speed:三种预定速度之一的字符串 (1000等
easing:用来指定切换效果 默认swing
fn:回调函数 在动画完成时执行的函数 每个元素执行一次
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="../js/jq.js"></script>
<style>
div {
/* 必须给盒子加定位才能动起来 */
position: absolute;
height: 200px;
width: 200px;
background-color: pink;
}
</style>
</head>
<body>
<button>点我</button>
<div>123</div>
<script>
$(function() {
$("button").click(function() {
$("div").animate({
left: 200,
top: 300,
opacity: 0.5
});
})
});
</script>
</body>
</html>