Bootstrap 模态框禁用空白处点击关闭
前段时间把modal模块单独取了出来研究了一些,想日后加点功能什么的,突然发现Bootstrap的模态框点击空白处会关闭,毕竟Bootstrap是移动设备优先的框架,默认上会让手机设备的操作更加简便,但是pc上并不建议附带此功能,如何禁用?
设置data-backdrop="static"属性;
<div class="modal fade" data-backdrop="static" id="myModal1"><!-- 在class为modal标签处添加 -->
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span >×</span></button>
<h4 class="modal-title">Modal title</h4>
</div>
<div class="modal-body">
<p>One fine body…</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
网友评论