简体   繁体   English

Bootstrap:Accordion Collapse停止使用Bootstrap 2.0.3

[英]Bootstrap: Accordion Collapse stopped working with Bootstrap 2.0.3

My accordion using data-toggle="collapse" and data-parent="#selector" works fine with Bootstrap 2.0.2, but when I switch to 2.0.3 the accordion functionality stops working. 我的手风琴使用data-toggle="collapse"data-parent="#selector"适用于Bootstrap 2.0.2,但是当我切换到2.0.3时,手风琴功能停止工作。

It still opens and closes the target div , but it won't automatically close an open target div when another td with data-toggle="collapse" is clicked. 它仍会打开和关闭目标 div ,但是当单击另一个带有data-toggle="collapse" td时,它不会自动关闭打开的目标 div

You can see it not working with 2.0.3 here: http://chooserealtoday.com/#faq 你可以在这里看到它不能与2.0.3一起使用: http//chooserealtoday.com/#faq

The following code example is also on JSFiddle at http://jsfiddle.net/N7MN9/3/ . 以下代码示例也在JSFiddle上,网址为http://jsfiddle.net/N7MN9/3/

<table id="faq-table" class="table table-bordered">
  <tr>
    <td class="question" data-toggle="collapse" data-target="#answer1" data-parent="#faq-table">
      <p><strong>What is your name?</strong></p>
      <div id="answer1" class="answer collapse">
        <p>Mark Rummel</p>
      </div>
    </td>
  </tr>
  <tr>
    <td class="question" data-toggle="collapse" data-target="#answer2" data-parent="#faq-table">
       <p><strong>What is your favorite color?</strong></p>
       <div id="answer2" class="answer collapse">
         <p>Blue, no yellow.</p>
       </div>
     </td>
  </tr>
</table>

Thanks for any help you can offer on this! 感谢您提供的任何帮助!

I see two options 我看到两个选择

actives = this.$parent && this.$parent.find('> .accordion-group > .in')

by the 2.0.2 version : 由2.0.2版本:

actives = this.$parent && this.$parent.find('.in')

You can solve this without modifying the Bootstrap files: just throw in the .accordion-group class. 您可以在不修改Bootstrap文件的情况下解决此问题:只需输入.accordion-group类。

Reference 参考

I wrote this extension to allow using collapse with a table. 我写了这个扩展名以允许使用表格折叠。 It allows you to specify the selector used to find active siblings in a collapse group. 它允许您指定用于在折叠组中查找活动同级的选择器。

bootstrap-collapse-activeselector 引导崩溃,activeselector

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM