inside example bootstrap anidados acordeones twitter-bootstrap accordion

example - Accordion Inside Accordion twitter bootstrap?



bootstrap accordion inside accordion (4)

Encontré que la solución de Alessandro no funciona con Bootstrap 3. Aquí hay una que funciona (un poco diferente, sin un panel expandido por defecto. Si necesita alguno, solo agregue "en" clase):

<div class="panel-group" id="accordion1"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a class="panel-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne"> Collapsible Group #1 </a></h4> </div> <div id="collapseOne" class="panel-body collapse"> <div class="panel-inner"> This is a simple accordion inner content... </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a class="panel-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo"> Collapsible Group #2 (With nested accordion inside) </a></h4> </div> <div id="collapseTwo" class="panel-body collapse"> <div class="panel-inner"> <!-- Here we insert another nested accordion --> <div class="panel-group" id="accordion2"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a class="panel-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseInnerOne"> Collapsible Inner Group Item #1 </a></h4> </div> <div id="collapseInnerOne" class="panel-body collapse"> <div class="panel-inner"> Anim pariatur cliche... </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a class="panel-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseInnerTwo"> Collapsible Inner Group Item #2 </a></h4> </div> <div id="collapseInnerTwo" class="panel-body collapse"> <div class="panel-inner"> Anim pariatur cliche... </div> </div> </div> </div> <!-- Inner accordion ends here --> </div> </div> </div> </div>

Estoy tratando de implementar un acordeón dentro de otro acordeón usando Twitter Bootstrap. ¿Es posible? si es así, ayúdeme con el código porque intenté implementarlo pero no tuve éxito.


Esto funciona de forma más fluida en Bootstrap v3.2.0.

<div class="panel-group" id="accordion1"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion1" href="#collapseOne"> Collapsible Group #1 </a></h4> </div> <div id="collapseOne" class="panel-collapse collapse in"> <div class="panel-body"> This is a simple accordion inner content... </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo"> Collapsible Group #2 (With nested accordion inside) </a></h4> </div> <div id="collapseTwo" class="panel-collapse collapse"> <div class="panel-body"> <!-- Here we insert another nested accordion --> <div class="panel-group" id="accordion2"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion2" href="#collapseInnerOne"> Collapsible Inner Group Item #1 </a></h4> </div> <div id="collapseInnerOne" class="panel-collapse collapse in"> <div class="panel-body"> Anim pariatur cliche... </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"><a data-toggle="collapse" data-parent="#accordion2" href="#collapseInnerTwo"> Collapsible Inner Group Item #2 </a></h4> </div> <div id="collapseInnerTwo" class="panel-collapse collapse"> <div class="panel-body"> Anim pariatur cliche... </div> </div> </div> </div> <!-- Inner accordion ends here --> </div> </div> </div> </div>


Si utiliza eventos de colapso en elementos colapsables anidados, ayuda a evitar que los eventos de colapso se acumulen por encima del nivel de grupo de paneles. De lo contrario, los eventos de colapso activados por elementos colapsables internos alcanzarán a los elementos externos que intentan manejar los eventos de colapso activados por sus propios elementos colapsables y causarán un comportamiento inesperado.

$(''.panel-group'').on(''show.bs.collapse shown.bs.collapse hide.bs.collapse hidden.bs.collapse'', function (e) { e.stopPropagation(); });

Este ejemplo supone que utiliza "grupo de paneles" como nombre de clase para agrupar elementos colapsables.


Simplemente incluya otro acordeón dentro del div con la clase acordeón-interno:

<div class="accordion" id="accordion1"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseOne"> Collapsible Group #1 </a> </div> <div id="collapseOne" class="accordion-body collapse in"> <div class="accordion-inner"> This is a simple accordion inner content... </div> </div> </div> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion1" href="#collapseTwo"> Collapsible Group #2 (With nested accordion inside) </a> </div> <div id="collapseTwo" class="accordion-body collapse"> <div class="accordion-inner"> <!-- Here we insert another nested accordion --> <div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseInnerOne"> Collapsible Inner Group Item #1 </a> </div> <div id="collapseInnerOne" class="accordion-body collapse in"> <div class="accordion-inner"> Anim pariatur cliche... </div> </div> </div> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseInnerTwo"> Collapsible Inner Group Item #2 </a> </div> <div id="collapseInnerTwo" class="accordion-body collapse"> <div class="accordion-inner"> Anim pariatur cliche... </div> </div> </div> </div> <!-- Inner accordion ends here --> </div> </div> </div> </div>

Recuerda usar diferentes identificaciones de acordeón.