如何从其余其他图标中定位单个图标?

时间:2019-08-21 23:29:16

标签: jquery css font-awesome accordion

我有一个手风琴列表,单击时每个手风琴都会展开(+)和折叠(-)。问题是,当我尝试展开一个手风琴选项卡时,它会很好地展开和折叠,但是即使未单击其他所有手风琴,图标“-” /“ +”符号也会切换。我希望'-'/'+'图标仅针对我单击的手风琴进行切换,而不针对其他手风琴进行切换。

cshtml:
<h2 class="accordion-toggle collapsed" data-toggle="collapse" href="#anyId" name=""><button>@l.GetElementValue("Title")</button></h2>

 <div id="anyId" class="collapse">
    @foreach ())
   {
     // looping through accordion list. 
   }
  </div>



CSS:
.accordion-toggle:after {
    font-family: 'FontAwesome'; /* essential to enable caret symbol*/
    content: "\f068"; /* adjust as needed, taken from font-awesome.css */
    color: #0046ad;
    position: absolute;
    left: .5em;
    top: 50%;
    margin-top: -12px;
    font-size: 25px;

}

.accordion-toggle.collapsed:after {
    /* symbol for "collapsed" panels */
    /*font-family: 'FontAwesome';*/
    content: "\f067"; /* adjust as needed, taken from font-awesome.css */
    /*color: #0046ad;
    position: absolute;
    left: .5em;
    top: 50%;
    margin-top: -12px;
    font-size: 25px;*/
}

1 个答案:

答案 0 :(得分:1)

默认情况下,只需删除折叠的类并在css下使用即可。

img_fname = '1209270004-1.jpg'
s = df1.eq(img_fname).mul(df1.index.to_series(), 0).sum()
print (s)
1    2
2    4
3    0
4    3
dtype: int64

out = np.where(s == 0, 45, s).sum()
print (out)
54

请参考下面我在这里使用您的结构的链接。忽略js只是尝试使用CSS,

https://jsfiddle.net/jignashagpatel/rmpnaq59/7/