我需要创建一个引导手风琴。下面的标记工作正常,但它不会自动折叠先前打开的元素。例如,打开 panel1,然后单击 panel2.. panel1 应该会自动关闭,但它不会。我曾尝试从引导站点 (http://twitter.github.com/bootstrap/javascript.html#collapse) 完全复制标记,但它不起作用。我错过了什么?
<h3>ACCORDION DEMO</h3>
<div class="accordion" id="accordion1">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-parent="accordion1" data-toggle="collapse" href="#panel1">Panel 1</a>
</div>
<div class="accordion-body collapse" id="panel1">
<div class="accordion-inner">
<p>This is accordion panel 1 content</p>
</div>
</div>
</div>
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-parent="accordion1" data-toggle="collapse" href="#panel2">Panel 2</a>
</div>
<div class="accordion-body collapse" id="panel2">
<div class="accordion-inner">
<p>This is accordion panel 2 content</p>
</div>
</div>
</div>
</div>