twitter-bootstrap 引导程序 3 在模式弹出后禁用背景

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39672346/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:18:34  来源:igfitidea点击:

bootstrap 3 disable background after modal popup

javascriptjqueryhtmltwitter-bootstrapbootstrap-modal

提问by dollar

I am trying to popup bootstrap 3 modal in my code using below given code

我正在尝试使用下面给定的代码在我的代码中弹出引导程序 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>

I want to disable background completely and only modal should be active at the time, like this

我想完全禁用背景,当时只有模态应该处于活动状态,就像这样

I want like this given below enter image description here

我想要下面给出的这个 在此处输入图片说明

and this is what I am getting enter image description here

这就是我得到的 在此处输入图片说明

回答by Sumit patel

Try This

试试这个

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

More Info Here

更多信息在这里