1.JQ動(dòng)畫
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery動(dòng)畫</title>
<style type="text/css">
.box{
width: 100px;
height: 100px;
background-color: gold;
}
</style>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
('#div1').animate({
width: 200,
height: 200},
1000,
function(){
// alert('動(dòng)畫完了!');
(this).animate(
{marginTop: 500},
1000
)
}
)
}
);
})
</script>
</head>
<body>
<div id="div1" class="box"></div>
</body>
</html>
2.JQ循環(huán)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery循環(huán)</title>
<style type="text/css">
</style>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(function(){
// //給全部的li設(shè)置內(nèi)容和樣式
// $('.list li').html('111');
// $('.list li').css({background:'gold'});
//第一個(gè)參數(shù)index是索引值
$('.list li').each(function(index) {
// alert(index);//彈出索引值
//$(this)是每一個(gè)li
$(this).html(index);
});
})
</script>
</head>
<body>
<ul class="list">
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>