Twitter Bootstrap手风琴背景子弹

时间:2013-04-15 22:57:50

标签: jquery twitter-bootstrap

当Twitter Bootstrap的手风琴折叠和扩展时,我希望有一个子弹更换/交换。我用子弹的背景图像。

现在,在这个jsfiddle http://jsfiddle.net/fBd4a/10/中,当页面加载时,应用的子弹是' - '。但是在项目展开并折叠后,它会保留“+”项目符号。我想从头开始'+'子弹。

感谢。

@import url('http://twitter.github.com/bootstrap/assets/css/bootstrap.css');

.container {
    margin-top: 10px;
}
.accordion .accordion-group .accordion-heading a.accordion-toggle.collapsed {background: #e9e8e8 url(http://i.imgur.com/pdB4oDz.png) no-repeat 0 11px;} 
.accordion .accordion-group .accordion-heading a.accordion-toggle {background: #e9e8e8 url(http://i.imgur.com/9zfyr43.png) no-repeat 0 20px;}

<div class="accordion" id="accordion2">
  <div class="accordion-group">
    <div class="accordion-heading">
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
        Collapsible Group Item #1
      </a>
    </div>
    <div id="collapseOne" class="accordion-body collapse">
      <div class="accordion-inner">
        Anim pariatur cliche...
      </div>
    </div>
  </div>
  <div class="accordion-group">
    <div class="accordion-heading">
      <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
        Collapsible Group Item #2
      </a>
    </div>
    <div id="collapseTwo" class="accordion-body collapse">
      <div class="accordion-inner">
        Anim pariatur cliche...
      </div>
    </div>
  </div>
</div>
<script src="http://twitter.github.io/bootstrap/assets/js/bootstrap-collapse.js"></script>

1 个答案:

答案 0 :(得分:2)

如果您需要以加号开头的代码,请将collapsed类添加到a类,其类别为accordion-toggle

请参阅Fiddle