Bootstrap导航按预期折叠,但在点击汉堡包时不显示下拉。 JSFiddle示例here - 使用: bootstrap / 3.3.7 / css / bootstrap.min.css 和 bootstrap / 3.3.7 / js / bootstrap.min.js 作为我的两个外部资源。
我发现其他人声明按钮的数据目标需要与包含折叠导航的div的ID匹配。就我而言,data-target =" #page-nav-tabs"和我的div id =" page-nav-tabs"。但这仍然不起作用....请帮助!
更新:发现折叠菜单的修复程序未打开 - 需要包含jquery脚本。现在,我仍然有一个问题,即"创建新的"下拉不起作用。
<section id="right-pane-wrapper">
<section id="secondary-nav" class="row">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#page-nav-tabs" 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>
</div>
<div class="collapse navbar-collapse" id="page-nav-tabs">
<ul class="nav navbar-nav">
<li><a href="#">Summary</a></li>
<li class="active"><a href="#">Claim Tree</a></li>
<li><a href="#">Assignment</a></li>
<li><a href="#">Reserve Summary</a></li>
<li><a href="#">Related Claims</a></li>
<li><a href="#">Indicators</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<button type="button" class="btn btn-default dropdown-toggle">Create New <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><span><a id="addNotification" href="#"><span>Reminder</span></a></span></li>
<li><span><a id="addMessage" href="#"><span>Message</span></a></span></li>
<li><span><a href="#"><span>Letter</span></a></span></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</section>
</section>
答案 0 :(得分:0)
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<section id="right-pane-wrapper">
<section id="secondary-nav" class="row">
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#page-nav-tabs" 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>
</div>
<div class="collapse navbar-collapse" id="page-nav-tabs">
<ul class="nav navbar-nav">
<li><a href="#">Summary</a></li>
<li class="active"><a href="#">Claim Tree</a></li>
<li><a href="#">Assignment</a></li>
<li><a href="#">Reserve Summary</a></li>
<li><a href="#">Related Claims</a></li>
<li><a href="#">Indicators</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown" href="#">Create New <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><span><a id="addNotification" href="#"><span>Reminder</span></a></span></li>
<li><span><a id="addMessage" href="#"><span>Message</span></a></span></li>
<li><span><a href="#"><span>Letter</span></a></span></li>
</ul>
</li>
</ul>
</div>
</div>
</nav>
</section>
</section>
</body>
</html>
检查一下它现在正在使用
或者只需用
替换按钮行<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Create New <span class="caret"></span></button>