Bootstrap模态 - 背景问题

时间:2018-03-02 19:26:48

标签: javascript jquery twitter-bootstrap

我遇到了bootstrap模式的背景问题。模态本身工作正常,但背景不会变灰,请参见下图。

https://github.com/BVLC/caffe/issues/6270

模态的代码是:

<div class="modal fade" id="issuesModal" tabindex="-1" role="dialog" aria-
labelledby="exampleModalLabel" aria-hidden="true" data-backdrop="static">
    <div class="modal-dialog modal-md modal-dialog-centered" role="document">
        <div class="modal-content">
            <div class="modal-header" style="background-color:#0066b2;color:#FFFFFF">
                <h5 class="modal-title" id="exampleModalLabel"></h5>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-6 col-lg-3 col-form-label">
                            ...
                        </div>
                        <div class="col-lg-9 form-text">
                            ...
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-6 col-lg-3 col-form-label">
                            ...
                        </div>
                        <div class="col-lg-9 form-text">
                            ...
                        </div>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary">OK</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

有什么想法吗?谢谢!

1 个答案:

答案 0 :(得分:0)

我无法重现这个问题,我使用了你的HTML,似乎可以正常工作

注意他人 我只是添加了这个答案,以显示OP他的HTML工作 - 我会在OP发布Minimal, Complete, Verifiable Example后删除答案

&#13;
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>


<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#issuesModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="issuesModal" tabindex="-1" role="dialog" aria- labelledby="exampleModalLabel" aria-hidden="true" data-backdrop="static">
  <div class="modal-dialog modal-md modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header" style="background-color:#0066b2;color:#FFFFFF">
        <h5 class="modal-title" id="exampleModalLabel"></h5>
      </div>
      <div class="modal-body">
        <div class="container-fluid">
          <div class="row">
            <div class="col-6 col-lg-3 col-form-label">
              ...
            </div>
            <div class="col-lg-9 form-text">
              ...
            </div>
          </div>
          <div class="row">
            <div class="col-6 col-lg-3 col-form-label">
              ...
            </div>
            <div class="col-lg-9 form-text">
              ...
            </div>
          </div>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary">OK</button>
        <button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;