A
A
Alexander Yank2016-09-11 15:45:26
JavaScript
Alexander Yank, 2016-09-11 15:45:26

When collapsing, remove the class from the previous paragraph?

I use bootstrap collapse, the question is:
I have 3 open items, I need to click on the item after the first one to close the previous one here codepen.io/alex-lenk/pen/LRpBwj

Please help me.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2016-09-11
@alex-lenk

$('.panel-collapse').on('hide.bs.collapse', function () {
  var $target = $(this).parent('.panel').prev('.panel').children('.panel-collapse');
  if ($target) $target.collapse('hide');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question