首頁  >  文章  >  web前端  >  jQuery使用fadein方法實現漸出效果實例_jquery

jQuery使用fadein方法實現漸出效果實例_jquery

WBOY
WBOY原創
2016-05-16 16:07:281085瀏覽

本文實例講述了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程式設計有所幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn