A
A
Alexander Yank2016-10-25 16:20:17
JavaScript
Alexander Yank, 2016-10-25 16:20:17

How to prevent collapse panel from closing in bootstrap 3?

I need one of the items to be open all the time bootstrap-3.ru/javascript.php#collapse-examples
did not find such information in the docks.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kovalsky, 2016-10-25
@alex-lenk

Run this code on the example page :

$('#accordion a:first').on('click', function(e) {
  if (!$( this ).hasClass('collapsed')) {
    e.preventDefault();
    e.stopPropagation();
  }
});

Bypassing the bootstrap: by clicking on the first header, we disable the execution of the remaining listeners if the first block is open (not closed).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question