欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)DIV層收縮展開(kāi)的方法

 更新時(shí)間:2015年02月27日 11:18:18   作者:代碼家園  
這篇文章主要介紹了jQuery實(shí)現(xiàn)DIV層收縮展開(kāi)的方法,實(shí)例分析了jQuery中toggle與animate等方法的使用技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)DIV層收縮展開(kāi)的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:

復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery實(shí)現(xiàn)DIV層的收縮展開(kāi)效果</title>
<script type="text/javascript" src="/images/jquery.js"></script>
<style>
/* 收縮展開(kāi)效果 */
.text{line-height:22px;padding:0 6px;color:#666;}
.box h1{padding-left:10px;height:22px;line-height:22px;background:#f1f1f1;font-weight:bold;}
.box{position:relative;border:1px solid #e7e7e7;}
</style>
</head>
<body>
<script type="text/javascript">
// 收縮展開(kāi)效果
$(document).ready(function(){
   $(".box h1").toggle(function(){
     $(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow");
   },function(){
$(this).next(".text").animate({height: 'toggle', opacity: 'toggle'}, "slow");
   });
});
</script>
<!-- 收縮展開(kāi)效果 -->
<div class="box">
<h1>收縮展開(kāi)效果</h1>
<div class="text">
        1<br />
        2<br />
        3<br />
        4<br />
        5<br />
</div>
</div>
<br />
<div class="box">
<h1>收縮展開(kāi)效果</h1>
<div class="text">
        1<br />
        2<br />
</div>
</div>
<br>
<font color=red>第一次運(yùn)行請(qǐng)刷新一下頁(yè)面。</font>
</body>
</html>

希望本文所述對(duì)大家的jquery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論