📅  最后修改于: 2023-12-03 15:39:31.802000             🧑  作者: Mango
引导程序4 | 手风琴 是一款基于HTML、CSS、JavaScript的可定制化手风琴组件,具有良好的可扩展性和丰富的功能。适用于构建网站、应用程序的页面效果,具有很高的实用性和美观性。
<link rel="stylesheet" type="text/css" href="bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="accordion.css">
<script src="jquery.min.js"></script>
<script src="bootstrap.min.js"></script>
<script src="accordion.js"></script>
<div class="accordion" id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Collapsible Group Item #1
</button>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Collapsible Group Item #2
</button>
</h5>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingThree">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
Collapsible Group Item #3
</button>
</h5>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
<div class="card-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et.
</div>
</div>
</div>
</div>
$('#accordion').accordion({
iconFont: 'iconfont', // IconFont所在的class
iconSize: '15px', // Icon大小
iconPosition: 'right', // Icon相对于文本的位置
borderColor: '#ddd', // 边框颜色
borderWidth: '1px', // 边框宽度
borderRadius: '5px', // 边框圆角半径
bgColor: '#f5f5f5', // 背景颜色
async: false, // 是否异步加载数据
data: [], // 数据源
callback: { // 回调函数
onClick: function() {},
onCollapse: function() {},
onExpand: function() {}
}
});
点击这里查看示例代码。
引导程序4 | 手风琴是一款十分实用的组件,可以提供丰富的手风琴效果,并且具有很高的自定义性和扩展性。希望这份介绍对您对手风琴组件的理解和使用有所帮助。