在 Bootstrap 上使用模态时滚动条消失
Scrollbar disappearing when use modal on Bootstrap
所以,我尝试在我的菜单中的 link <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">×</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>
看看滚动条的区别
添加
divName.modal-open {
overflow: scroll;
}
这将适用于 bootstrap
的 v3
所以,我尝试在我的菜单中的 link <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">×</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>
看看滚动条的区别
添加
divName.modal-open {
overflow: scroll;
}
这将适用于 bootstrap
的 v3