我设法创建的导航栏工作得很好。但是,当我通过重新调整窗口大小来折叠导航栏时,它会在我尝试打开该视图中的菜单时消失。 为什么下拉菜单在移动视图中消失。我做错了什么?
HTML code:
<nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top">Kirori Mal College</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="true">Why Recruit? <span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="#">Why Recruit?</a></li>
<li><a href="#">Demographics</a></li>
<li><a href="#">Faculty</a></li>
<li><a href="#">Academics</a></li>
<li><a href="#">Alumni</a></li>
</ul>
</li>
<!-- End of nav bar tabs -->
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>