Search code examples
javascriptjquerytwitter-bootstraptwitter-bootstrap-2

Why bootstrap modal callback fired when a collapse inside modal is opened


I notice a strange behavior in bootstrap 2.3.2 where i have a collapse panel inside a modal . So when collapse is opened the modal callbacks(e.g.show,shown) are also fired. Cannot figure out why this is happening. Check here http://www.bootply.com/WHBcMZ6puA#

Is it a bug ?


Solution

  • That's a known issue. People wrote a solution, but it doesn't work.

    $('#myModal').find('.accordion-toggle').on('hidden', function (event) {
        event.stopPropagation()
    });    
    

    It's namespacing problem, which was resolved in bootstrap 3 version. My recommendation, switch to bootstrap v3.