JuliaCesar JuliaCesar - 6 months ago 60
Javascript Question

Twitter Bootstrap: Accordion plugin collides with Modal

I was faced with a problem when using an accordion in the pop-up modal (all are Twitter Bootstrap plugins).
Modal has closed whenever any accordion block was toggled.


Accordion collapse fires a 'hidden' event, which is actual for Modal plugin too. So, there is a way to prevent modal closing:

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

Hope hat helps you.