????????????????????????????????????????????????jQuery特殊效果
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery特殊效果</title>
<style type="text/css">
.box{
width: 200px;
height: 200px;
background-color: gold;
display: none;
}
</style>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript">
$(function(){
$('#btn').click(function(){
// $('.box').fadeOut();//淡出
// $('.box').fadeIn();//淡入
// $('.box').fadeToggle();//切換淡入淡出
// $('.box').toggle();//切換顯示隱藏
$('.box').slideToggle();//切換上收和下展
})
})
</script>
</head>
<body>
<input type="button" name="" value="效果" id="btn">
<div class="box"></div>
</body>
</html>
......................................................................................................................................................................
????????????????????????????????????????????????????jQuery動畫
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery動畫</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">
$(function(){
/*
參數(shù):
1佩谷、什么屬性做動畫,屬性設(shè)置{param1: value1, param2: value2}
2、動畫執(zhí)行的時間救湖,單位毫秒
3算谈、動畫曲線:
swing(默認(rèn)值)開始和結(jié)束慢荠藤,中間快
linear勻速
可省略不寫
4甫菠、回調(diào)函數(shù)锰霜,動畫完成之后要做的事情示姿,可無限嵌套
*/
$('#div1').animate({
width: 200,
height: 200},
1000,
function(){
// alert('動畫完了甜橱!');
$(this).animate(
{marginLeft: 500},
1000,
function(){
$(this).animate(
{marginTop: 500},
1000
)
}
)
}
);
})
</script>
</head>
<body>
<div id="div1" class="box"></div>
</body>
</html>
......................................................................................................................................................................
????????????????????????????????????????????????????jQuery循環(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'});
//第一個參數(shù)index是索引值
$('.list li').each(function(index) {
// alert(index);//彈出索引值
//$(this)是每一個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>
......................................................................................................................................................................