I have added a bootstrap accordion in my project.
I realise the only showing section can be closed too, but I hope that at least one section stays open in any situation. I'm not sure how I can prevent the only showing section from closing?
Credit to Jonathan La'Fey, I think I'll just post his link as an answer to close the post
How do you make Twitter Bootstrap Accordion keep one group open?
$('.panel-heading a').on('click',function(e){
if($(this).parents('.panel').children('.panel-collapse').hasClass('in')){
e.stopPropagation();
}
// You can also add preventDefault to remove the anchor behavior that makes
// the page jump
// e.preventDefault();
});
It will prevent the only showing window from closing.