演示效果: http://www.21jn.net
注意:改动前先备份,备份、备份、备份、备份、备份、备份、备份、备份、备份、备份、备份、备份
1.把下面的js代码保存为单独的js文件.当前例子为21jn.js .上传至网站目录下的 include/js文件夹中
(命令不规范,呵呵,有兴趣的朋友再改好了)- function setTaba(area,id,menu) {
- for(j=1; j<=8; j++) {
- document.getElementById(menu+j).style.display='none';
- document.getElementById(menu+'a'+j).style.display='';
- }
-
-
- document.getElementById(id).style.display='none';
- document.getElementById(area).style.display='';
- }
复制代码 注意了:如果你的数据没有8条的话,是看不到效果的,你可以先把j<=8改为实际的数据. 或者增加数据直到有8条
2.在模板index.html.php头部增加引用21jn.js代码
<script src="{S_URL}/include/js/21jn.js" type="text/javascript" language="javascript"></script>
3.现在开始改造滑动门效果了(本想把改动的思路说说,但好像又不知从何说起了,还是先把代码放出来吧!以后再把相关的改动细节写出来)
--------相册改造后的代码--------------------------------------------------
<div id="aaa1" class="tabcontent">
<div id="ppp" class="huadong">
<ul id="pppttts" class="ttts">
<!--{block name="spaceimage" parameter="order/i.viewnum DESC,i.replynum DESC,i.goodrate DESC/limit/0,1/subjectlen/30/showdetail/1/cachename/image/tpl/data"}--><!--自定义相册调用-->
<!--{eval $i=1;}-->
<!--{loop $_SBLOCK['image'] $key $value}-->
<li id="spaceimage$i" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[image]" alt="$value[subjectall]" /></a >
<h4><a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></h4>
创建者:<a href="#uid/$value[uid]#" target="_blank">$value[username]</a>
<br />上传日期: #date("m-d h:m", $value["dateline"])#
</div>
</li>
<li id="spaceimagea$i" style="display:none" onMouseOver="javascript:setTaba('spaceimage$i','spaceimagea$i','spaceimage')" class="div1">
<span><strong>$i</strong> <a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
<!--{block name="spaceimage" parameter="order/i.viewnum DESC,i.replynum DESC,i.goodrate DESC/limit/1,7/subjectlen/30/showdetail/1/cachename/image/tpl/data"}--><!--自定义相册调用-->
<!--{eval $i=2;}-->
<!--{loop $_SBLOCK['image'] $key $value}-->
<li id="spaceimage$i" style="display:none" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[image]" alt="$value[subjectall]" /></a >
<h4><a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></h4>
创建者:<a href="#uid/$value[uid]#" target="_blank">$value[username]</a>
<br />上传日期: #date("m-d h:m", $value["dateline"])#
</div>
</li>
<li id="spaceimagea$i" onMouseOver="javascript:setTaba('spaceimage$i','spaceimagea$i','spaceimage')" class="div1">
<span><strong>$i</strong> <a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
</ul>
</div>
</div>
<div id="aaa2" class="tabcontent" style="display: none;">
<div id="ppp" class="huadong">
<ul id="pppttts" class="ttts">
<!--{block name="spaceimage" parameter="order/i.dateline DESC/limit/0,1/subjectlen/30/showdetail/1/cachename/image/tpl/data"}--><!--自定义最新相册调用-->
<!--{eval $i=1;}-->
<!--{loop $_SBLOCK['image'] $key $value}-->
<li id="spaceimageNew$i" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[image]" alt="$value[subjectall]" /></a >
<h4><a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></h4>
创建者:<a href="#uid/$value[uid]#" target="_blank">$value[username]</a>
<br />上传日期: #date("m-d h:m", $value["dateline"])#
</div>
</li>
<li id="spaceimageNewa$i" style="display:none" onMouseOver="javascript:setTaba('spaceimageNew$i','spaceimageNewa$i','spaceimageNew')" class="div1">
<span><strong>$i</strong> <a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
<!--最新图片-->
<!--{block name="spaceimage" parameter="order/i.dateline DESC/limit/1,7/subjectlen/30/showdetail/1/cachename/image/tpl/data"}--><!--自定义最新相册调用-->
<!--{eval $i=2;}-->
<!--{loop $_SBLOCK['image'] $key $value}-->
<li id="spaceimageNew$i" style="display:none" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[image]" alt="$value[subjectall]" /></a >
<h4><a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></h4>
创建者:<a href="#uid/$value[uid]#" target="_blank">$value[username]</a>
<br />上传日期: #date("m-d h:m", $value["dateline"])#
</div>
</li>
<li id="spaceimageNewa$i" onMouseOver="javascript:setTaba('spaceimageNew$i','spaceimageNewa$i','spaceimageNew')" class="div1">
<span><strong>$i</strong> <a href="$value[url]" target="_blank" title="$value[subjectall]">$value[subject]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
</ul>
</div>
</div>
空间位置改造后的代码
<div id="ddd1" class="tabcontent">
<div id="ppp" class="huadong">
<ul id="pppttts" class="ttts">
<!--{block name="userspace" parameter="order/u.spaceallnum DESC,u.viewnum DESC/limit/0,1/cachename/group/tpl/data"}--><!--热门空间-头条-->
<!--{eval $i=1;}-->
<!--{loop $_SBLOCK['group'] $key $value}-->
<li id="userspace$i" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[photo]" width="78" height="78" alt="$value[spacename]" /></a>
<h4><a href="#uid/$value[uid]#" target="_blank">$value[username]</a></h4>
信息数: $value[spaceallnum]
<br />创建于 #date("Y-m-d", $value["dateline"])#
</div>
</li>
<li id="userspacea$i" style="display:none" onMouseOver="javascript:setTaba('userspace$i','userspacea$i','userspace')" class="div1">
<span><strong>$i</strong><a href="#uid/$value[uid]#" target="_blank">$value[spacename]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
<!--{block name="userspace" parameter="order/u.spaceallnum DESC,u.viewnum DESC/limit/1,7/cachename/group/tpl/data"}--><!--热门空间-->
<!--{eval $i=2;}-->
<!--{loop $_SBLOCK['group'] $key $value}-->
<li id="userspace$i" style="display:none" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[photo]" width="78" height="78" alt="$value[spacename]" /></a>
<h4><a href="#uid/$value[uid]#" target="_blank">$value[username]</a></h4>
信息数: $value[spaceallnum]
<br />创建于 #date("Y-m-d", $value["dateline"])#
</div>
</li>
<li id="userspacea$i" onMouseOver="javascript:setTaba('userspace$i','userspacea$i','userspace')" class="div1">
<span><strong>$i</strong><a href="#uid/$value[uid]#" target="_blank">$value[spacename]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
</ul>
</div>
</div>
<div id="ddd2" class="tabcontent" style="display: none;">
<div id="ppp" class="huadong">
<ul id="pppttts" class="ttts">
<!--{block name="userspace" parameter="order/u.dateline DESC/limit/0,1/cachename/group/tpl/data"}--><!--最新空间-头条-->
<!--{eval $i=1;}-->
<!--{loop $_SBLOCK['group'] $key $value}-->
<li id="userspaceNew$i" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[photo]" width="78" height="78" alt="$value[spacename]" /></a>
<h4><a href="#uid/$value[uid]#" target="_blank">$value[username]</a></h4>
信息数: $value[spaceallnum]
<br />创建于 #date("Y-m-d", $value["dateline"])#
</div>
</li>
<li id="userspaceNewa$i" style="display:none" onMouseOver="javascript:setTaba('userspaceNew$i','userspaceNewa$i','userspaceNew')" class="div1">
<span><strong>$i</strong><a href="#uid/$value[uid]#" target="_blank">$value[spacename]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
<!--{block name="userspace" parameter="order/u.dateline DESC/limit/1,7/cachename/group/tpl/data"}--><!--最新空间-->
<!--{eval $i=2;}-->
<!--{loop $_SBLOCK['group'] $key $value}-->
<li id="userspaceNew$i" style="display:none" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[photo]" width="78" height="78" alt="$value[spacename]" /></a>
<h4><a href="#uid/$value[uid]#" target="_blank">$value[username]</a></h4>
信息数: $value[spaceallnum]
<br />创建于 #date("Y-m-d", $value["dateline"])#
</div>
</li>
<li id="userspaceNewa$i" onMouseOver="javascript:setTaba('userspaceNew$i','userspaceNewa$i','userspaceNew')" class="div1">
<span><strong>$i</strong><a href="#uid/$value[uid]#" target="_blank">$value[spacename]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
</ul>
</div>
</div>
<div id="ddd3" class="tabcontent" style="display: none;">
<div id="ppp" class="huadong">
<ul id="pppttts" class="ttts">
<!--{block name="userspace" parameter="order/u.lastpost DESC/limit/0,1/cachename/group/tpl/data"}--><!--最近更新-头条-->
<!--{eval $i=1;}-->
<!--{loop $_SBLOCK['group'] $key $value}-->
<li id="userspaceUpdate$i" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[photo]" width="78" height="78" alt="$value[spacename]" /></a>
<h4><a href="#uid/$value[uid]#" target="_blank">$value[username]</a></h4>
信息数: $value[spaceallnum]
<br />创建于 #date("Y-m-d", $value["dateline"])#
</div>
</li>
<li id="userspaceUpdatea$i" style="display:none" onMouseOver="javascript:setTaba('userspaceUpdate$i','userspaceUpdatea$i','userspaceUpdate')" class="div1">
<span><strong>$i</strong><a href="#uid/$value[uid]#" target="_blank">$value[spacename]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
<!--{block name="userspace" parameter="order/u.lastpost DESC/limit/1,7/cachename/group/tpl/data"}--><!--最近更新-->
<!--{eval $i=2;}-->
<!--{loop $_SBLOCK['group'] $key $value}-->
<li id="userspaceUpdate$i" style="display:none" class="div1 div2">
<div class="xiangxi"><span><strong>$i</strong></span>
<a href="$value[url]" target="_blank"><img src="$value[photo]" width="78" height="78" alt="$value[spacename]" /></a>
<h4><a href="#uid/$value[uid]#" target="_blank">$value[username]</a></h4>
信息数: $value[spaceallnum]
<br />创建于 #date("Y-m-d", $value["dateline"])#
</div>
</li>
<li id="userspaceUpdatea$i" onMouseOver="javascript:setTaba('userspaceUpdate$i','userspaceUpdatea$i','userspaceUpdate')" class="div1">
<span><strong>$i</strong><a href="#uid/$value[uid]#" target="_blank">$value[spacename]</a></span>
</li>
<!--{eval $i++;}-->
<!--{/loop}-->
</ul>
</div>
</div>
[ 本帖最后由 Lzhou 于 2007-11-2 16:56 编辑 ] |