久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线
Discuz! 官方交流社區(qū)
標題:
分享收起展開圖標,同時請教一個問題
[打印本頁]
作者:
一定
時間:
2025-8-6 12:13
標題:
分享收起展開圖標,同時請教一個問題
想要類似官網(wǎng)這種收起與展開,能力有限弄了個圖標版,先看演示圖。
(, 下載次數(shù): 3)
上傳
點擊文件名下載附件
(, 下載次數(shù): 3)
上傳
點擊文件名下載附件
其實最好是svg版的,比較高清,但是變量是$cat[collapseimg],解析出來是gif尾巴格式的,200行左右,代碼是:
<img id="category_$cat[fid]_img" src="template/dingzhi_2021_book/dingzhi/$cat[collapseimg]" title="{lang spread}" alt="{lang spread}" onclick="toggle_collapse('category_$cat[fid]');"/>
復制代碼
下面分享gif版的圖標:
(, 下載次數(shù): 4)
上傳
點擊文件名下載附件
(, 下載次數(shù): 2)
上傳
點擊文件名下載附件
svg版的圖標無法上傳,想要的可以QQ聯(lián)系我,然后最后求助:怎么將這個改成SVG版的,模板作者是用的默認啥的,不知道哪里處理的,只知道收起與展開是:【
onclick="toggle_collapse('category_$cat[fid]');】。
作者:
弄月
時間:
2025-8-6 13:30
.tg_no:before
.tg_yes:before
換這個就可以了
作者:
一定
時間:
2025-8-6 14:19
弄月 發(fā)表于 2025-8-6 13:30
.tg_no:before
.tg_yes:before
你這個咋用?不過我解決了,用CSS+DIV,不用JS,也沒用SVG模式,這里分享出來吧,留給后面有緣人。
CSS代碼
/*板塊收起與展開*/
.toggle-container {
display: inline-block;
vertical-align: middle;
margin-right: 5px;
}
.toggle-checkbox {
position: absolute;
opacity: 0;
}
.toggle-label {
cursor: pointer;
display: inline-block;
-webkit-tap-highlight-color: transparent;
}
.toggle-switch {
position: relative;
width: 33px;
height: 18px;
background-color: #e0e0e0;
border-radius: 11px;
box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
transition: all 0.3s ease;
}
.toggle-switch-handle {
position: absolute;
width: 16px;
height: 16px;
background-color: white;
border-radius: 50%;
top: 1px;
left: 1px;
box-shadow: 0 1px 3px rgba(0,0,0,0.2);
transition: all 0.3s ease;
}
.toggle-checkbox:checked + .toggle-label .toggle-switch {
background-color: #4285f4;
}
.toggle-checkbox:checked + .toggle-label .toggle-switch-handle {
transform: translateX(15px);
}
復制代碼
DIV代碼
<!--板塊收起與展開-->
<div class="toggle-container">
<input type="checkbox" id="category_$cat[fid]_toggle" class="toggle-checkbox" checked>
<label for="category_$cat[fid]_toggle"
onclick="toggle_collapse('category_$cat[fid]');"
class="toggle-label">
<div class="toggle-switch">
<span class="toggle-switch-handle"></span>
</div>
</label>
</div></span>
復制代碼
歡迎光臨 Discuz! 官方交流社區(qū) (http://www.9999xn.com/)
Powered by Discuz! W1.0