Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I specify multiple data targets for Twitter Bootstrap collapse?

I'd like to target two divs for expand when clicking on a single trigger? Is that possible?

like image 385
mtndan Avatar asked Dec 02 '13 22:12

mtndan


People also ask

How do I create a collapsible menu in bootstrap?

Just add data-toggle="collapse" and a data-target to the element to automatically assign control of one or more collapsible elements. The data-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element.

What is data toggle and data-target in bootstrap?

The toggle tells Bootstrap what to do and the target tells Bootstrap which element is going to open. So whenever a link like that is clicked, a modal with an id of “basicModal” will appear.

What is bootstrap 4 collapse?

collapse class indicates a collapsible element (a <div> in our example); this is the content that will be shown or hidden with a click of a button. To control (show/hide) the collapsible content, add the data-toggle="collapse" attribute to an <a> or a <button> element.

What is data BS toggle?

The data-toggle is an HTML-5 data attribute defined in Bootstrap. The advantage of using this is that, you can select a class or an id and hook up the element with a particular widget.


Video Answer


1 Answers

You can simply add all the ids separated by commas in data-target:

<button type="button" data-toggle="collapse" data-target="#demo,#demo1,#demo2">   Hide them all </button> 
like image 137
Franck Valentin Avatar answered Oct 14 '22 17:10

Franck Valentin