javascript – Bootstrap:Accordion Collapse停止使用Bootstrap 2.0.3

我的手风琴使用data-toggle =“collapse”和data-parent =“#selector”适用于Bootstrap 2.0.2,但是当我切换到2.0.3时,手风琴功能停止工作.

它仍会打开和关闭目标div,但是当单击另一个带有data-toggle =“collapse”的td时,它不会自动关闭打开的目标div.

你可以在这里看到它不能与2.0.3一起使用:http://chooserealtoday.com/#faq

以下代码示例也在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>

感谢您提供的任何帮助!

解决方法

我看到两个选择

>使用div而不是table(转到示例http://twitter.github.com/bootstrap/javascript.html#collapse)
>修改bootstrap.js并替换:

actives = this.$parent&&这个.$parent.find(‘> .accordion-group> .in’)

由2.0.2版本:

actives = this.$parent&&这一点.$parent.find(”.在)

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...