0
我有一個使用Bootstrap的可摺疊列表,當內容摺疊時,我無法實現圖標的更改。我試過以下這篇文章:http://www.w3schools.com/bootstrap/bootstrap_ref_js_collapse.asp,但我不知道如何定義&:before.collapse.in
css類來改變它。摺疊時引導3導航/列表更改圖標
有人可以幫我嗎?
HTML:
<ul class="ls-nav">
<li><!--
--><a role="button" data-toggle="collapse" href="#collapseContent" aria-expanded="true" aria-controls="collapseContent"><!--
-->Lorem ipsum
</a>
<div class="collapse" id="collapseContent">
<ul class="ls-inner">
<li>Lorem ipsum</li>
<li>Lorem ipsum</li>
<li>
<a role="button" data-toggle="collapse" href="#collapseContent-2" aria-expanded="true" aria-controls="collapseContent-2"><!--
-->Lorem ipsum
</a>
<div class="collapse" id="collapseContent-2">
<ul class="ls-inner-dot">
<li class="active">Lorem ipsum</li>
<li>Lorem ipsum</li>
</ul>
</div>
</li>
<li>Lorem ipsum</li>
</ul>
</div>
</li>
<li>Lorem ipsum</li>
<li>Lorem ipsum</li>
</ul>
SCSS/CSS:
.ls-nav {
}
li {
list-style: none;
&:before {
font-family: 'Fonticons';
content: "\f009";
}
&:before .collapse.in {
content: "\f00a"
}
}
.ls-inner {
padding-left: 15px;
li {
&:before {
font-size: 0.6rem;
line-height: 0.8rem;
vertical-align: middle;
}
}
.ls-inner-dot {
padding-left: 15px;
.active {
color: $color_sail_approx;
}
li:before {
content: "●";
}
}
}
}
謝謝你,它工作正常,像這樣。有沒有可以應用於我的嵌套列表的js解決方案,所以我可以繼續使用它? – jstorm31