所以我不确定我的bootstrap导航栏是怎么回事,因为我似乎无法通过切换按钮来显示我的菜单项。我已经查看了类似的问题答案,建议在引导脚本之前加载jquery,我做了它仍然无法正常工作。
这是我的HTML代码:
<nav class="navbar navbar-default" style="border-radius: 0;">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed burger-button" data-toggle="collapse" data-target="#cutom-bs-navbar-collapse-1" aria-expanded="false">
<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 jura-font" href="/#!/">COLIGN</a>
</div>
<div class="collapse navbar-collapse" id="custom-bs-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><a href="#"><span class="glyphicon glyphicon-flag"></span></a></li>
<li><a href="#"><span class="glyphicon glyphicon-comment"></span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-user"></span></a>
<ul class="dropdown-menu">
<li><a href="#">View Profile</a></li>
<li><a href="#">Manage Account</a></li>
<li><a href="#">Invite a friend</a></li>
<li role="separator" class="divider"></li>
<li><a href="/auth/signout">Log out</a></li>
</ul>
</li>
</ul>
<form class="navbar-form text-center" role="search">
<div class="form-group nav-search-group">
<input type="text" class="form-control nav-search-input" placeholder="search for patents and research...">
</div>
<!-- <button type="submit" class="btn btn-default">Submit</button> -->
</form>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
答案 0 :(得分:0)
you have typo in data-target. it must be
<button type="button" class="navbar-toggle collapsed burger-button" data-toggle="collapse" data-target="#custom-bs-navbar-collapse-1" aria-expanded="false">