本文實例講述了jQuery使用fadein方法實現漸出效果的方法。分享給大家供大家參考。具體分析如下:
下面的JS代碼通過jQuery的fadein方法控制指定色塊逐漸顯示的功能
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#div1").fadeIn();
$("#div2").fadeIn("slow");
$("#div3").fadeIn(3000);
});
});
</script>
</head>
<body>
<p>Demonstrate fadeIn() with different parameters.</p>
<button>Click to fade in boxes</button>
<br><br>
<div id="div1"
style="width:80px;height:80px;display:none;background-color:red;">
</div><br>
<div id="div2"
style="width:80px;height:80px;display:none;background-color:green;">
</div><br>
<div id="div3"
style="width:80px;height:80px;display:none;background-color:blue;">
</div>
</body>
</html>
希望本文所述對大家的jQuery程序設計有所幫助。