所以,我尝试在菜单中的链接<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>
我打电话给&#39; js&#39;以多种形式
<!-- 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>
查看滚动条的区别。
答案 0 :(得分:1)
添加
divName.modal-open {
overflow: scroll;
}
这将在bootstrap的v3中起作用