我正在使用 Twitter Bootstrap 创建可折叠的文本部分。当按下 + 按钮时,这些部分会展开。我的html代码如下:
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<button type="button" class="btn btn-primary" data-toggle="collapse" data-target="#demo">
<span class="glyphicon glyphicon-chevron-down"></span> Open
</button>
</h4>
</div>
<div id="demo" class="panel-collapse collapse in">
<div class="panel-body">
Contents:Thank you to help me solve the problem, you're a great guy!
</div>
</div>
</div>
</div>
稍后,我需要更改文本、按钮图标并展开。
开了:
<button type="button" class="btn btn-primary" data-toggle="collapse" data-target="#demo">
<span class="glyphicon glyphicon-chevron-up"></span> Close
</button>
关闭:
<button type="button" class="btn btn-primary" data-toggle="collapse" data-target="#demo">
<span class="glyphicon glyphicon-chevron-down"></span> Open
</button>