看到blueidea很多朋友都發(fā)了一些 收縮與展開內(nèi)容的效果,唯一差的就是一個(gè)緩沖效果.不多說,運(yùn)行一下就知道了,呵呵. 最大高度還需要固定數(shù) " /> 亚洲午夜av,色呦呦在线观看视频,日韩精品久久久久久久电影99爱

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

帶緩沖的 收縮與展開內(nèi)容效果

兼容ie5.5+   firefox2.0(因?yàn)槲抑挥羞@兩個(gè)瀏覽器,所以只在它們中做了測試)

看到blueidea很多朋友都發(fā)了一些 收縮與展開內(nèi)容的效果,唯一差的就是一個(gè)緩沖效果.不多說,運(yùn)行一下就知道了,呵呵.
最大高度還需要固定數(shù)值.沒有很好的解決方案.有興趣的朋友幫忙解決一下拉,謝謝.
這個(gè)代碼其他部分不會再發(fā)出更新和完善之后的了.如果需要封裝就自己做做吧,呵呵.

放出代碼為分享學(xué)習(xí)之用.請尊重別人的作品勿作商業(yè)用途!!!!!
復(fù)制代碼 代碼如下:
<html>
<head>
<script>
/*
By Auntion
QQ 82874972
歡迎喜歡Javascript 和 ajax的朋友++我QQ,大家共同進(jìn)步,呵呵
使用方法
調(diào)用效果: Effect(1,2);
  其中1為: 被改變對象的id
  其中2為: 控制容器的id  可在使用:  this.parentNode.id  取得(父標(biāo)簽的id)
注意給對象ID的時(shí)候一定不要重復(fù).
*/
function $G(Read_Id) { return document.getElementById(Read_Id) }
function Effect(ObjectId,parentId){
    if ($G(ObjectId).style.display == 'none'){
    Start(ObjectId,'Opens');
    $G(parentId).innerHTML = "<a href=# onClick=Javascript:Effect('"+ObjectId+"','"+parentId+"');>關(guān)閉</a>"
    }else{ 
    Start(ObjectId,'Close');
    $G(parentId).innerHTML = "<a href=# onClick=Javascript:Effect('"+ObjectId+"','"+parentId+"');>打開</a>"
    }
}
function Start(ObjId,method){
var BoxHeight = $G(ObjId).offsetHeight;               //獲取對象高度
var MinHeight = 5;                                    //定義對象最小高度
var MaxHeight = 130;                                 //定義對象最大高度
var BoxAddMax = 1;                                    //遞增量初始值
var Every_Add = 0.15;                                //每次的遞(減)增量  [數(shù)值越大速度越快]
var Reduce = (BoxAddMax - Every_Add);
var Add    = (BoxAddMax + Every_Add);
if (method == "Close"){
var Alter_Close = function(){                        //構(gòu)建一個(gè)虛擬的[遞減]循環(huán)
    BoxAddMax /= Reduce;
    BoxHeight -= BoxAddMax;
    if (BoxHeight <= MinHeight){
        $G(ObjId).style.display = "none";
        window.clearInterval(BoxAction);
    }
    else $G(ObjId).style.height = BoxHeight;
}
var BoxAction = window.setInterval(Alter_Close,1);
}
else if (method == "Opens"){
var Alter_Opens = function(){                        //構(gòu)建一個(gè)虛擬的[遞增]循環(huán)
    BoxAddMax *= Add;
    BoxHeight += BoxAddMax;
    if (BoxHeight >= MaxHeight){
        $G(ObjId).style.height = MaxHeight;
        window.clearInterval(BoxAction);
    }else{
    $G(ObjId).style.display= "block";
    $G(ObjId).style.height = BoxHeight;
    }
}
var BoxAction = window.setInterval(Alter_Opens,1);
}
}
</script>
<style>
body,div,table { font-size:12px;}
#control{ width:200; background-color:#ccc; font-size:12px; font-color:#333333; text-align:center; }
#control a { font-weight:900; line-height:30px; color:#333333; }
.test{ height:130;width:200;background-color:#ccc;display:block;overflow:hidden; }
.STYLE1 {
    font-size: 8px;
    color: #FFFFFF;
}
</style>
</head>
<body>
<div id="control">
  <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="100%" align="center" bgcolor="#2DD5FF" id="testtab"><a href="#" onClick="Effect('test',this.parentNode.id);">關(guān)閉</a></td>
    </tr>
  </table>
</div>
<div id="test" class="test">
  <table width="100%" height="130" border="0" cellpadding="4" cellspacing="0" bgcolor="#EEEEEE">
    <tr>
      <td colspan="3" align="center" valign="top">這<br>
        里<br>
        是<br>
        第<br>
        二<br>
        ,<br>
        很<br>
        正<br>
        常<br></td>
    </tr>
  </table>
</div>
<div id="control">
  <table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="100%" align="center" valign="bottom" bgcolor="#00C0F0"><span class="STYLE1">▲</span></td>
    </tr>
  </table>
</div>
<br>
<div id="control">
  <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="100%" align="center" bgcolor="#2DD5FF" id="test1tab"><a href="#" onClick="Effect('test1',this.parentNode.id);">關(guān)閉</a></td>
    </tr>
  </table>
</div>
<div id="test1" class="test">
  <table width="100%" height="130" border="0" cellpadding="4" cellspacing="0" bgcolor="#EEEEEE">
    <tr>
      <td colspan="3" align="center" valign="top">這<br>
        里<br>
        是<br>
        第<br>
        一<br>
        ,<br>
        很<br>
        正<br>
        常<br></td>
    </tr>
  </table>
</div>
<div id="control">
  <table width="100%" height="10" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="100%" align="center" valign="bottom" bgcolor="#00C0F0"><span class="STYLE1">▲</span></td>
    </tr>
  </table>
</div>
</body>
</html>

兩個(gè)都關(guān)閉的狀態(tài)

[Ctrl+A 全選 注:如需引入外部Js需刷新才能執(zhí)行]
一個(gè)打開一個(gè)關(guān)閉的狀態(tài)

[Ctrl+A 全選 注:如需引入外部Js需刷新才能執(zhí)行]
美化下的

[Ctrl+A 全選 注:如需引入外部Js需刷新才能執(zhí)行]

JavaScript技術(shù)帶緩沖的 收縮與展開內(nèi)容效果,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 杭锦旗| 合川市| 忻城县| 秀山| 成都市| 佛坪县| 龙口市| 永州市| 阳江市| 贞丰县| 长乐市| 陕西省| 双江| 漳平市| 乌鲁木齐县| 台安县| 老河口市| 宁化县| 长治市| 凤城市| 尉犁县| 宁蒗| 商都县| 阳原县| 商都县| 黄大仙区| 横山县| 卢龙县| 安庆市| 大港区| 巴彦淖尔市| 鄂尔多斯市| 鄂托克旗| 伽师县| 通州区| 彰武县| 同江市| 陈巴尔虎旗| 正安县| 邵东县| 叙永县|