abstract:隱藏,顯示,淡入淡出等相對(duì)簡(jiǎn)單,平時(shí)也經(jīng)常用,就沒(méi)做案例,主要掌握animate()與stop的使用方法<!doctype html><html><head><meta charset="gbk"><title>JQ動(dòng)畫作業(yè)</title><script src="jquery-3.3.1.
隱藏,顯示,淡入淡出等相對(duì)簡(jiǎn)單,平時(shí)也經(jīng)常用,就沒(méi)做案例,主要掌握animate()與stop的使用方法
<!doctype html>
<html>
<head>
<meta charset="gbk">
<title>JQ動(dòng)畫作業(yè)</title>
<script src="jquery-3.3.1.min.js"></script>
</head>
<style>
.box{width:100px;height:100px;background:#ccc;position:absolute}
</style>
<script>
$(function(){
$('button').click(function(){
$('.box').animate({left:"400px",width:'200px',height:'200px',background:'#f00',opacity:'0.3'},1500,function(){
alert('DIV變大變透明啦');
});
})
$('#stop').click(function(){
$('.box').stop(true)
})
$('#finish').click(function(){
$('.box').stop(true,true)
})
})
</script>
<body>
<button>移動(dòng)DIV</button><button id='stop'>停止</button><button id='finish'>立即結(jié)束</button>
<div></div>
</body>
</html>
Correcting teacher:韋小寶Correction time:2019-01-04 10:34:00
Teacher's summary:案例是很重要的,課后一定要多寫點(diǎn)小案例!這樣才能提升的快!