简体   繁体   中英

How to collapse/expand an accordion with bootstrap progressively without close the others?

Hi I have the following code: http://www.bootply.com/peFUdnwOpZ

I want to open each panel when I click on the panel heading without close the others were opened, How can I do it?.

Do not add, data-parent="#accordion" attribute. It will disable the accordion (one at a time) like feature.

I've saw the docu of Bootstrap, http://getbootstrap.com/javascript/#collapse-usage and i think it could be solved using:

$('#myCollapsible').collapse({
  toggle: false
})

Try and tell us. Thanks

Yes it works, you must change the id, and use your container. In your fiddle put this js

$('.closeall').click(function(){
  $('.panel-collapse.in')
    .collapse('hide');
});
$('.openall').click(function(){
  $('.panel-collapse:not(".in")')
    .collapse('show');
});
$('#container').collapse({
  toggle: false
});

Try and tell us. Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM