bootstrap 3在模态弹出后禁用背景

时间:2016-09-24 04:01:38

标签: javascript jquery html twitter-bootstrap bootstrap-modal

我正在尝试使用下面给出的代码

在我的代码中弹出bootstrap 3模态
  <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="false" aria-hidden="true" data-keyboard="false">
  <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">&times;</span></button>
          <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
  <div class="modal-body">
    ...
  </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>
  </div>
  </div>

我想完全禁用背景,当时只有模态应该是活动的,比如

我想要如下所示 enter image description here

这就是我得到的 enter image description here

1 个答案:

答案 0 :(得分:2)

试一下

$('#myModal').modal({backdrop: 'static', keyboard: false})  ;

更多信息Here