Bootstrap 导航栏下拉菜单未打开

Bootstrap navbar dropdown not opening

Bootstrap 导航按预期折叠但在单击汉堡包时不显示下拉菜单。 JSFiddle 示例 here - 使用:bootstrap/3.3.7/css/bootstrap.min.cssbootstrap/3 .3.7/js/bootstrap.min.js 作为我的两个外部资源。

我发现其他人指出按钮的数据目标需要与包含折叠导航的 div 的 ID 相匹配。在我的例子中,data-target="#page-nav-tabs" 和我的 div id="page-nav-tabs"。但这仍然不起作用....请帮助!

更新:找到折叠菜单无法打开的修复程序 - 需要包含 jquery 脚本。现在,我仍然遇到 "Create New" 下拉菜单不起作用的问题。

<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>
<!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>