Topic: Bootstrap collapse plugin Collapsible Buttons

Lars7 pro asked 5 years ago


Hi, I would like to use 2 collapse butons like is used in the Javascript --> Collapse basic example. I have created sepeate dropdown sections for each button by targeting #collapseExample1 & #collapseExample2 What i am struggling to do is to have one section dropdown and hide the other section if it is open Does anyone know how i can do this? my code is: <button class="btn btn-primary btn-rounded" type="button" data-toggle="collapse" data-target="#collapseExample1" aria-expanded="false" aria-controls="collapseExample"> Button with data-target 1 </button> <button class="btn btn-primary btn-rounded" type="button" data-toggle="collapse" data-target="#collapseExample2" aria-expanded="false" aria-controls="collapseExample"> Button with data-target 2 </button> <div class="collapse" id="collapseExample1"> <div class="card card-block"> Dropdown 1 </div> </div> <div class="collapse" id="collapseExample2"> <div class="card card-block"> dropdown 2 </div> </div>

Adrian Sawicki free answered 5 years ago


Hello McMeekin, In the JavaScript -> collapse at the end of the page you have methods. You can make a simple conditional statement (if) with them to toggle between your double collapse. Regards, Adrian

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags