css - 在 Bootstrap 上使用模态时滚动条消失

标签 css twitter-bootstrap twitter-bootstrap-3 bootstrap-modal

所以,我尝试在链接上放置一个模式 <li>在我的菜单中,但是当我点击它时,页面的滚动条消失了。

看,这是我的菜单:

<nav class="navbar navbar-default bg-primary">
      <ul class="nav navbar-nav navbar-right">
        <li ><a href="#myModal" role="button" data-toggle="modal">History</a></li>
              <!-- Modal -->
<div class="modal fade" role="dialog" id="myModal" tabindex="-1" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <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 fontblue" id="myModalLabel"> Project</h4>
      </div>
      <div class="modal-body">
<p class="line">
This page is... x x x
</p>
      </div>
    </div>
  </div>
</div>
      </ul>
</nav>

我以多种形式调用'js'

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

Without click

after click modal

看看滚动条的区别。

最佳答案

添加

divName.modal-open {
   overflow: scroll;
  }

这将在 Bootstrap 的 v3 中工作

关于css - 在 Bootstrap 上使用模态时滚动条消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28695464/

相关文章:

twitter-bootstrap-3 - React Bootstrap 工具提示,如何触发它?

html - 如何在表格单元格 "height: 100%"内创建一个 div

javascript - Bootstrap Dropdown JavaScript 不适用于多个下拉菜单

css - Bootstrap 3 流体网格布局问题;长元素会导致堆叠问题

php - 带有 Twitter Bootstrap 布局的动态列插入

javascript - 使用 leafletjs 和 bootstrap 加载 map 图 block 时出现问题

jquery - 我可以以编程方式关闭可折叠导航栏显示的下拉菜单吗?

html - Bootstrap with ASP.net 不使用全屏

jquery - 自组织布局

html - 使用 css-transforms 为遇到定位问题的所有浏览器创建掩码