Twitter Bootstrap的手风琴和多个孩子

时间:2013-04-20 09:03:35

标签: twitter-bootstrap accordion jquery-ui-accordion

如何展开/展示多个孩子?目前未显示Service2。

<div class="accordion" id="accordion1">
<div class="accordion-group">
    <div class="accordion-heading">
        <div class="accordion-toggle group-accordion-toggle">
            <a href="#collapseOne" data-parent="#accordion1"
               data-toggle="collapse" class=""><i
                    class="icon-plus"></i></a>
            <a href="http://www.example.com">Operator</a>
        </div>
    </div>

    <div id="collapseOne" class="accordion-body collapse">
        <div class="accordion-inner"><a
                href="http://www.example.com/service1">Service1</a></div>
    </div>

    <div id="collapseOne" class="accordion-body collapse">
        <div class="accordion-inner"><a
                href="http://www.example.com/service2">Service2</a></div>
    </div>

</div>

http://jsfiddle.net/mejo/CXDC8/

1 个答案:

答案 0 :(得分:1)

您是否只能从<div id="collapseOne" class="accordion-body collapse">移除Section2容器?

    <div id="collapseOne" class="accordion-body collapse">

        <div class="accordion-inner"><a
                href="http://www.example.com/service1">Service1</a>
        </div>

        <div class="accordion-inner"><a
                href="http://www.example.com/service2">Service2</a>
        </div>
    </div>

这里有JSFiddle说明我的意思。

此外,如果有两个具有相同ID的元素,这可能会导致问题进一步发展。