gpt4 book ai didi

twitter-bootstrap - Bootstrap : Collapsing/expading with icons issue

转载 作者:行者123 更新时间:2023-12-05 01:06:47 26 4
gpt4 key购买 nike

我使用 Bootstrap JavaScript 库并使其工作折叠/展开元素。代码如下所示:

<div id="e_ticket_info" class="e_ticket_font" runat="server" Visible="False">
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" style="color:firebrick; font-size: large;">
E-TICKET...
</a>
<i class="icon-large icon-arrow-down"></i>
</h1>
</div>
<div id="collapseOne" class="panel-collapse collapse">
<div class="panel-body">
Some text...
</div>
</div>
</div>
</div>
</div>

如您所见,我能够显示向下箭头图标。当我单击 Accordion 元素时,文本会向下扩展我想要的内容,但是此时我需要将向下箭头图标切换为向上箭头图标,反之亦然,当单击 Accordion 元素以折叠文本以再次显示向下箭头图标时。

怎么做?

最佳答案

CSS

/** 
Created new class toggle arrow that uses the sprite
coordinates for the up and down arrows in bootstrap.
**/

.toggle-arrow{
background-position: -289px -96px;
}

/**
This specific selector will cause the toggling
bootstrap adds and removes the collapsed class on the accordian.
**/

.collapsed .toggle-arrow{
background-position: -312px -96px;
}

HTML
<!-- Nested the i tag within the a toggle by collapsed -->
<div class="panel-heading">
<h1 class="panel-title">
<!-- Initialized a with class="collapsed" -->
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne"
style="color:firebrick; font-size: large;" class="collapsed">
E-TICKET...
<i class="icon-large toggle-arrow"></i>
</a>
</h1>
</div>

JS fiddle : http://jsfiddle.net/uBzeZ/1/

关于twitter-bootstrap - Bootstrap : Collapsing/expading with icons issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19490340/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com