Twitter Bootstrap: Accordion Plugin Collides with Modal

I ran into a problem when using an accordion in a pop-up modal (all these are Twitter Bootstrap plugins). Modal closes whenever any accordion block is switched.

+5
source share
2 answers

Accordion collapse fires a "hidden" event, which is also relevant for the Modal module. Thus, there is a way to prevent modal closure:

$(document).on('click', 'a.accordion-toggle', function(e) {
    $(e.target).parent().siblings('.accordion-body').on('hidden', function(e) {
        e.stopPropagation();
    });
});

You need a Hope hat.

+8
source

@JuliaCesar. Your answer did not help me, but he pointed me to a solution:

$('.collapse').on('hidden', function(e){ 
  e.stopPropagation(); 
});
+2
source

All Articles