Collapse Toggle the visibility of content across your project with a few classes.
The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the height from its current value to 0. Given how CSS handles animations, you cannot use padding on a .collapse element. Instead, use the class as an independent wrapping element. Find more facts and uses at the bootstrap official documentation.
Basic example
-
.collapse
hides content -
.collapsing
is applied during transitions -
.collapse.show
shows content
data-target
attribute. In both cases, the data-toggle="collapse"
is required.
Multiple Targets
<button>
or <a>
can show and hide multiple elements by referencing them with a JQuery selector in its href
or data-target
attribute. Multiple <button>
or <a>
can show and hide an element if they each reference it with their href
or data-target
attribute
Accordion example
.collapse
state using the classes .collapsed-reveal
and .collapsed-hidden
Make sure the
.collapsed-*
classes are inside the data-toggle="collapse"
element or adjacent to it