Collapse
Toggle the visibility of content across your project with a few classes and our JavaScript plugins.
How it works
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.
Basic example
Click the buttons below to show and hide another element via class changes:
.collapse
hides content.collapsing
is applied during transitions.collapse.show
shows content
Multiple targets
A <button>
or <a>
can show and hide multiple elements by
referencing them with a selector in its href. Multiple <button>
or
<a>
can show and hide an element if they each
reference it with their href.