如何启用模态的背景阴影



我创建了一个用于注册和登录的引导模式。我发现,当我使用引导模态时,当模态弹出背景时,背景不会像它应该的那样自动被阴影化。我找不到原因。我希望打开模态时背景有点暗,以便用户可以只关注模态内容。我还希望模态定位到屏幕中心。那么请谁能告诉我该怎么做?

以下是我的模态代码?

                              <!-- Modal -->
  <div class="modal reg_modal " id="regestration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"   >
    <div class="modal-dialog" id="reg_outer_div" data-backdrop="true" >
      <div class="modal-content " style="background: white;width:700px;">
        <div class="modal-header" id ="reg_modal_header" style="">
          <button type="button" class="close reg" id ="reg_close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title" align="center" style="color:white;" id="reg_log_modal_header_text">   </h4>
        </div><!--/header-->
         <div class="modal-body" style="background: white;" id="regmodal_body">

          </div><!-- /end modal body-->
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->

您的代码似乎工作正常。

<a data-toggle="modal" href="#regestration" class="btn btn-primary btn-large">Launch demo modal</a> 
<div class="modal reg_modal " id="regestration" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"   >
    <div class="modal-dialog" id="reg_outer_div" data-backdrop="true" >
      <div class="modal-content " style="background: white;width:700px;">
        <div class="modal-header" id ="reg_modal_header" style="">
          <button type="button" class="close reg" id ="reg_close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <h4 class="modal-title" align="center" style="color:white;" id="reg_log_modal_header_text">   </h4>
        </div><!--/header-->
         <div class="modal-body" style="background: white;" id="regmodal_body">

          </div><!-- /end modal body-->
      </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
  </div><!-- /.modal -->

查看小提琴 http://jsfiddle.net/x79kS/

检查您是否未包含 jquery 对话框。

有关文档,请参阅 http://getbootstrap.com/2.3.2/javascript.html#modals

相关内容

  • 没有找到相关文章