久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线
Discuz! 官方交流社區(qū)
標(biāo)題:
選項(xiàng)卡怎么隱藏其他的代碼?
[打印本頁]
作者:
一定
時(shí)間:
2023-2-2 14:59
標(biāo)題:
選項(xiàng)卡怎么隱藏其他的代碼?
之前不會(huì)用選項(xiàng)卡代碼,搞了4個(gè)單頁組合在一起,今天找了代碼,又研究了一下,基本實(shí)現(xiàn)了一個(gè)頁面選項(xiàng)卡應(yīng)用。
(, 下載次數(shù): 21)
上傳
點(diǎn)擊文件名下載附件
但是現(xiàn)在有一個(gè)問題,如明星等其他選項(xiàng)卡內(nèi)容也會(huì)有翻頁,點(diǎn)擊是默認(rèn)頁面的翻頁(明星等其他內(nèi)容是寫死內(nèi)容的),我現(xiàn)在想讓明星等選項(xiàng)卡內(nèi)容隱藏翻頁代碼。
(, 下載次數(shù): 15)
上傳
點(diǎn)擊文件名下載附件
選項(xiàng)卡div代碼
<div class="nav1">
<div class="active">默認(rèn)</div>
<div class="">明星</div>
<div class="">推書</div>
<div class="">TXT</div>
</div>
<!--選項(xiàng)卡start-->
<div class="taglist">
<div class="list">
<div>
<ul class="cl">
<!--{loop $tagarray $tag}-->
<li class="{echo $yide_color[array_rand($yide_color,1)];}">
<a href="tag-$tag[tagid].html">$tag[tagname]</a>
</li>
<!--{/loop}-->
</ul>
</div>
<div><ul class="cl">
<!--{block/189}-->
</ul></div>
<div>
<ul class="cl">
<!--{block/190}-->
</ul>
</div>
<div><ul class="cl">
<!--{block/192}-->
</ul></div>
</div>
</div>
復(fù)制代碼
翻頁相關(guān)代碼
<div class="tag-pg" style="margin:20px 0 10px 0" >{$pageStyle}</div>
<!--{else}-->
<div class="zz_no_content cl">
<i class="iconfont icon-zanwuneirong-"></i>
<p>{lang no_tag}</p>
</div>
復(fù)制代碼
選項(xiàng)卡相關(guān)CSS
.bg {
background: #fff;
}
.taglist{padding: 10px 15px;
line-height: 13px;
font-size: 13px;
background: #fff;
}
.nav1{
width: 100%;
height: 50px;
display: flex;
background-color: #fff;
}
.nav1 div{
width: 30px;
height: 42px;
line-height: 50px;
text-align: center;
font-size: 14px;
margin: 0 0 0 30px;
}
.list{
width: 98%;
margin-left: 2%;
padding: 10px 0 0 0;
}
.list div{
width: 100%;
height: 100%;
}
.active{
background-color: #fff;
color: #333;
font-size: 14px;
border-bottom: 2.5px solid #59d192;
}
復(fù)制代碼
選項(xiàng)卡JS代碼
<script type="text/javascript">
let nav = document.getElementsByClassName('nav1')[0];
let but = nav.getElementsByTagName('div');
let list = document.getElementsByClassName('list')[0];
let item = list.getElementsByTagName('div');
// 隱藏多余選項(xiàng)列表
for(let i = 1; i < item.length; i++){
item[i].style.display = "none";
}
// 循環(huán)按鈕綁定事件
for(let k = 0; k < but.length; k++){
but[k].onclick = function(){
for(let j = 0; j < but.length; j++){
but[j].className = "";
item[j].style.display = "none";
}
but[k].className = "active";
item[k].style.display = "block";
}
}
console.log(item)
</script>
復(fù)制代碼
最后附上tag頁面的文件以及地址:https://www.honghuangwenxue.com/misc.php?mod=tag
(, 下載次數(shù): 95)
上傳
點(diǎn)擊文件名下載附件
作者:
一定
時(shí)間:
2023-2-2 21:08
已解決了。。。。
歡迎光臨 Discuz! 官方交流社區(qū) (http://www.9999xn.com/)
Powered by Discuz! W1.0