1

我有以下代码

<g:each in="${elementGroups}">
            <div class="accordion" id="accordion${it.id}">
                <!-- Element Group Heading -->
                <div class="accordion-heading">
                    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion${it.id}" href="#collapse${it.id}"> 
                    <b>${it.name}</b>
                    </a>
                </div>
                <!-- Elements -->
                <div id="collapse${it.id}" class="accordion-body collapse">
                    <g:each  var="element" in="${it.elements}">
                        <!--  -->
                        <div class="accordion" id="accordion${it.id}-${element.id}">
                            <div class="accordion-heading" style="margin-left: 30px">
                                <label class="radio" class="accordion-toggle" data-toggle="collapse"    data-parent="#accordion${it.id}-${element.id}" data-target="#collapseOne${it.id}-${element.id}">
                                <input type="radio" name="optionsCheckboxList" value="${element.id}"/>${element.name}
                                </label>
                            </div>
                            <div id="collapseOne${it.id}-${element.id}" class="accordion-body collapse">
                            <div class="accordion-inner" style="margin-left: 60px">

                            <!-- Sample Description -->
                            <g:each var="desc1" in="${element.descriptions}">
                                <input type="radio" name="selComment" value="${desc1.name}" onclick="populateComment(this.value)"/>${desc1.name}<br/>
                            </g:each>
                            </div></div>
                        </div>
                        <!--  -->
                    </g:each>
                </div>
            </div>
        </g:each>

请注意,有两个级别的手风琴具有正确的 id 和父 id。它们都是第一次扩展。一旦我改变了一些东西,手风琴就不再扩展了。可能是什么问题呢。

4

1 回答 1

0

您在and<div class="accordion-group">周围缺少 a 。这可能会导致你的问题。请参阅http://twitter.github.com/bootstrap/javascript.html#collapse上的示例并查看源代码以了解他们如何实现它。accordion-headingaccordion-body

于 2012-08-30T18:36:09.110 回答