サマリー:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Document</title><script type="text/javascript" src="jquery-3.3.1.min.js">
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript" src="jquery-3.3.1.min.js"></script>
<style type="text/css">
.box{
width: 200px;
height: 200px;
background: red;
text-align: center;
color: orange;
font-weight: bold;
border-radius: 20px;
position: absolute;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('.bt1').click(function(){
$('.box').animate({
left:'800px',
top:'400px',
width:'100px',
height:'100px',
opacity:'0.4',
},2800)
})
$('.bt2').click(function(){
$('.box').stop();
})
})
</script>
</head>
<body>
<button>點(diǎn)擊開始</button>
<button>點(diǎn)擊暫停</button>
<div>傾斜式移動(dòng)</div>
</body>
</html>
<!-- 獲取元素,給元素添加一個(gè)事件函數(shù),在函數(shù)內(nèi)獲取要操作的元素.stop().
stop()里面可以給參數(shù),也可以不給定 -->
添削の先生:韋小寶添削時(shí)間:2019-01-04 11:03:24
先生のまとめ:寫的很不錯(cuò)了,jQuery和js最有意思的地方就是動(dòng)畫效果很靈活!