如何在Bootstrap折叠中更改图标以满足多种需求
How to change icon in Bootstrap collapse for multiple requirments
我已经为三个不同的div使用了Bootstrap collapse来满足不同的需求。
第一次折叠div:我需要更改"显示文本并隐藏"的"glypion左下图标"。
<div class="col-md-12">
<span class="badge">
<span>0</span>
</span>
<span> Function</span>
<a data-toggle="collapse" data-parent="#accordion" href="#collapse1" class="fb_down_arrow">
<span class="glyphicon glyphicon-triangle-bottom"></span>
</a>
</div>
<ul class="fb_list_option collapse in" id="collapse1">
<li>
<input type="checkbox" id="c5" name="cc">
<label for="c5"><span></span>Corporate Real Estate</label>
</li>
</ul>
第二次折叠div:我需要更改"显示文本和隐藏"的"glypion加号和减号"图标。
<li>
<input type="checkbox" id="c92" name="cc">
<label for="c92"><span></span>Construction (###)</label>
<a href="" data-toggle="collapse" data-target="#fb_plus_one" class="" >
<span class="glyphicon glyphicon-plus fb_list_plus_arrow"></span>
</a>
<ul id="fb_plus_one" class="collapse in" aria-expanded="true">
<li>
<input type="checkbox" id="c01" name="cc">
<label for="c01"><span></span>Child 1</label>
</li>
</ul>
</li>
第三次折叠div:我需要更改"glypion左下图标",还需要更改显示文本和隐藏的"显示更多"、"显示更少"的文本。
<a href="#demo1" class="doc_right_title collapsed" data-toggle="collapse" aria-expanded="false">See more detail <span class="glyphicon KB_glyphicon glyphicon-triangle-left"></span></a>
<div class="row collapse in" id="demo1" aria-expanded="true">
</div>
脚本:我正在使用以下脚本存档第一个折叠div要求。请建议如何存档第二个&第三次崩溃。
// Collapse Start
$('.collapse').on('shown.bs.collapse', function(){
$(this).parent().find(".glyphicon-triangle-left")
.removeClass("glyphicon-triangle-left")
.addClass("glyphicon-triangle-bottom");
}).on('hidden.bs.collapse', function(){
$(this).parent().find(".glyphicon-triangle-bottom")
.removeClass("glyphicon-triangle-bottom")
.addClass("glyphicon-triangle-left");
});
// Collapse End
请尝试此
$('.collapse').on('shown.bs.collapse', function(){
e.stopImmediatePropagation()
$(this).parent().find(".glyphicon-triangle-left").first().removeClass("glyphicon-triangle-left").addClass("glyphicon-triangle-bottom");
}).on('hidden.bs.collapse', function(){
e.stopImmediatePropagation()
$(this).parent().find(".glyphicon-triangle-bottom").first().removeClass("glyphicon-triangle-bottom").addClass("glyphicon-triangle-left");
});
相关文章:
- Javascript更改图标
- 单击更改图标并通过javascript添加一个css类
- 我希望只有在我滚动页面后才能显示我的返回页首图标
- 如何更改角度谷歌地图上的集群图标
- simpleweather js天气图标
- 更改图层中单个矢量特征的图标
- 附加“;显示更多“;仅当满足设定的字符数时,链接到截断的段落
- 使用Angular单击时更改特定图示符图标的颜色
- 加载图像时加载图标
- 可以'点击汉堡包图标后,菜单无法正常打开
- 当满足PHP条件时显示一个弹出窗口
- 持久页面操作图标
- 点击图标是't在量角器上工作
- 通过单击同一图标使菜单出现和消失
- 如果满足某些条件,我如何才能创建一个只有值的对象
- 在for循环中使用多维数组设置google.maps.Marker图标
- 替换与单词'匹配的文本字符;购物车'替换为img图标
- 谷歌地图API-显示具有不同图标的标记
- 谷歌地图-更改图层图标大小
- 如何在Bootstrap折叠中更改图标以满足多种需求