)。
注意: 元素上你可以使用 href 属性来代替 data-target 属性:
实例
<
a
href
=
"
#demo
"
data-toggle
=
"
collapse
"
>
Collapsible
a
>
<
div
id
=
"
demo
"
class
=
"
collapse
"
>
Lorem ipsum dolor text....
div
>
尝试一下 »
默认情况下折叠的内容是隐藏的,你可以添加 .show 类让内容默认显示:
实例
<
div
id
=
"
demo
"
class
=
"
collapse show
"
>
Lorem ipsum dolor text....
div
>
尝试一下 »
以下实例通过扩展卡片组件来显示简单的手风琴。
注意: 使用 data-parent 属性来确保所有的折叠元素在指定的父元素下,这样就能实现在一个折叠选项显示时其他选项就隐藏。
实例
<
div
id
=
"
accordion
"
>
<
div
class
=
"
card
"
>
<
div
class
=
"
card-header
"
>
<
a
class
=
"
card-link
"
data-toggle
=
"
collapse
"
href
=
"
#collapseOne
"
>
选项一
a
>
div
>
<
div
id
=
"
collapseOne
"
class
=
"
collapse show
"
data-parent
=
"
#accordion
"
>
<
div
class
=
"
card-body
"
>
#1 内容:菜鸟教程 -- 学的不仅是技术,更是梦想!!!
div
>
div
>
div
>
<
div
class
=
"
card
"
>
<
div
class
=
"
card-header
"
>
<
a
class
=
"
collapsed card-link
"
data-toggle
=
"
collapse
"
href
=
"
#collapseTwo
"
>
选项二
a
>
div
>
<
div
id
=
"
collapseTwo
"
class
=
"
collapse
"
data-parent
=
"
#accordion
"
>
<
div
class
=
"
card-body
"
>
#2 内容:菜鸟教程 -- 学的不仅是技术,更是梦想!!!
div
>
div
>
div
>
<
div
class
=
"
card
"
>
<
div
class
=
"
card-header
"
>
<
a
class
=
"
collapsed card-link
"
data-toggle
=
"
collapse
"
href
=
"
#collapseThree
"
>
选项三
a
>
div
>
<
div
id
=
"
collapseThree
"
class
=
"
collapse
"
data-parent
=
"
#accordion
"
>
<
div
class
=
"
card-body
"
>
#3 内容:菜鸟教程 -- 学的不仅是技术,更是梦想!!!
div
>
div
>
div
>
div
>
尝试一下 »
分享名称:创新互联Bootstrap4教程:Bootstrap4折叠
当前地址:http://www.shufengxianlan.com/qtweb/news42/412792.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
广告
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源:
创新互联