# 16.模态框
[toc]{type: "ol", level: [3]}
### 模态框
```html
<div class="modal" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<!--模态框头部-->
<div class="modal-header">
<h5 class="modal-title">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<!--模态框体部-->
<div class="modal-body">
<p>Modal body text goes here.</p>
</div>
<!--模态框页脚-->
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
<button id="btn" class="btn btn-info">模态框</button>
```
```js
$('#btn').click(function () {
$('.modal').modal('show')
})
```
![模态框-模态框](16.模态框-模态框.png)