Key point
The data-target="#myModal" of the click button of the first modal box corresponds to the id="myModal" of the first modal box; so the activation of different modal boxes on a page is here. The data-target of the buttons of the two modal boxes is changed to data-target="#myModal_1"; the id of the second modal box is changed to id="myModal_1"; two different modal boxes can be opened separately. The same is true for adding multiple modal frames.
第一个模态框
按钮
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
模态框主体
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
模态框一号
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
第二个模态框
按钮
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal_1">
Launch demo modal
</button>
模态框主体
<div class="modal fade" id="myModal_1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
模态框二号
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>