Link with href
Button with data-bs-target
Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
<
a
class
=
"btn btn-primary"
data-bs-toggle
=
"collapse"
href
=
"#collapseExample"
role
=
"button"
aria-expanded
=
"false"
aria-controls
=
"collapseExample"
>
Link with href
<
button
class
=
"btn btn-primary"
type
=
"button"
data-bs-toggle
=
"collapse"
data-bs-target
=
"#collapseExample"
aria-expanded
=
"false"
aria-controls
=
"collapseExample"
>
Button with data-bs-target
</
button
>
<
div
class
=
"collapse"
id
=
"collapseExample"
>
<
div
class
=
"card card-body"
>
Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
</
div
>
</
div
>
Toggle first element
<
a
class
=
"btn btn-primary"
data-bs-toggle
=
"collapse"
href
=
"#multiCollapseExample1"
role
=
"button"
aria-expanded
=
"false"
aria-controls
=
"multiCollapseExample1"
>
Toggle first element
</
a
>
<
button
class
=
"btn btn-primary"
type
=
"button"
data-bs-toggle
=
"collapse"
data-bs-target
=
"#multiCollapseExample2"
aria-expanded
=
"false"
aria-controls
=
"multiCollapseExample2"
>
Toggle second element
</
button
>
<
button
class
=
"btn btn-primary"
type
=
"button"
data-bs-toggle
=
"collapse"
data-bs-target
=
".multi-collapse"
aria-expanded
=
"false"
aria-controls
=
"multiCollapseExample1 multiCollapseExample2"
>
Toggle both elements
</
button
>
<
div
class
=
"row"
>
<
div
class
=
"col"
>
<
div
class
=
"collapse multi-collapse"
id
=
"multiCollapseExample1"
>
<
div
class
=
"card card-body"
>
Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
</
div
>
</
div
>
</
div
>
<
div
class
=
"col"
>
<
div
class
=
"collapse multi-collapse"
id
=
"multiCollapseExample2"
>
<
div
class
=
"card card-body"
>
Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
</
div
>
</
div
>
</
div
>
</
div
>
Default
Description
selector | jQuery object | DOM element
false
如果加入了 parent,則當可折疊物件為顯示時,指定父項下的所有可折疊元素將被關閉。(類似于傳統的折疊控制項行為 - 這取決於 card)。該屬性必須在目標可折疊區域上設置。
toggle
boolean
切換可折疊元素
Asynchronous methods and transitions
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.