为什么我的引导下拉不起作用?

时间:2015-07-03 03:48:23

标签: php twitter-bootstrap drop-down-menu

这是代码,我正在尝试添加登录下拉列表。这是标题:

<head>
    <title>Forms Generator</title>
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">

    <link rel="stylesheet" type="text/css"
          href="<?php echo $path . 'css/main.css'; ?>" />             
</head>

<body>
<div id="page">
    <header class="navbar-inverse" role="banner">
    <nav class="navbar navbar-inverse">
        <div class="container">

  <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" 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" href="#">Forms Generator</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">
        <li class="active"><a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>">Home <span class="sr-only">(current)</span></a></li>
        <li class="active"><a href="/create">Create Form<span class="sr-only">(current)</span></a></li>
        <li class="active"><a href="/view_survey">View Surveys<span class="sr-only">(current)</span></a></li>
        <li class="active"><a href="/statistics">View Statistics<span class="sr-only">(current)</span></a></li>
      </ul>


      <!-- Working on dropdown here -->

       <ul class="nav navbar-nav navbar-right">
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
      </ul>

      <!-- END DROPDOWN WORK-->


    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</div>  
  </nav>

</header>
        <p>Interactive Forms Generation</p>
        <p>Enter links/buttons to create survey/take survey, etc here.</p>
    </div>
</div>

这是页脚的代码:

            <div id="footer">
                <p class="copyright">
                    &copy; <?php echo date("Y"); ?>
                </p>
            </div>
            </div>
        </div><!-- end page -->
       <!-- Latest compiled and minified JavaScript -->
       <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
    </body>
</html>

所以基本上我尝试添加到导航栏末尾的下拉列表并没有下降。为什么不这样做?

编辑:我正在运行XAMPP并使用Chrome。

2 个答案:

答案 0 :(得分:1)

<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

答案 1 :(得分:0)

将你的jquery文件放在bootstrap.js文件之前

<script src="script/jquery-3.2.0.js" type="text/javascript"></script>
<script src="script/bootstrap.js" type="text/javascript"></script>