サマリー:1,以前不知道這些函數(shù)里還可以加上function執(zhí)行其他動(dòng)作2animate只支持屬性值為數(shù)值的相關(guān)屬性,背景顏色類(lèi)的改變不了<!doctype html><html><head><meta charset="gbk"><title>JQ動(dòng)畫(huà)作業(yè)</title><script src="j
1,以前不知道這些函數(shù)里還可以加上function執(zhí)行其他動(dòng)作
2animate只支持屬性值為數(shù)值的相關(guān)屬性,背景顏色類(lèi)的改變不了
<!doctype html>
<html>
<head>
<meta charset="gbk">
<title>JQ動(dòng)畫(huà)作業(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變大變透明啦');
});
})
})
</script>
<body>
<button>移動(dòng)DIV</button>
<div></div>
</body>
</html>