2016-01-11 108 views
-3

我试图做一个下拉菜单,但由于某种原因,在下拉菜单中是不是working.I不知道如果我链接的JavaScript的文档右侧导航栏,但是这是怎么了每个人都这样做,但下拉菜单仍然无法正常工作。自举下拉菜单不会工作

这里我的代码:

<head> 


<style type="text/css"> 

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, th, td, iframe { 
    margin: 0px; 
    padding: 0px; 
} 


</style> 

<!-- Bootstrap Core CSS --> 
    <link href="css/bootstrap.min.css" rel="stylesheet"> 
    <link href="css/bootstrap.css" rel="stylesheet"> 
    <link href="css/bootstrap.css.map" rel="stylesheet"> 
    <link href="css/bootstrap.min.css.map" rel="stylesheet"> 
    <link href="css/bootstrap-theme.css" rel="stylesheet"> 
    <link href="css/bootstrap-theme.css.map" rel="stylesheet"> 
    <link href="css/bootstrap-theme.min.css" rel="stylesheet"> 
    <link href="css/bootstrap-theme.min.css.map" rel="stylesheet"> 

<script src="js/bootstrap.js"></script> 
<script src="js/bootstrap.min.js"></script> 
<script src="js/npm.js"></script> 
</head> 

<body > 




<nav class="navbar navbar-default"> 
    <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="#">list</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><a href="" class="choice">Announcements</a></li> 

      <li><a href="" class="choice">GetMotivated</a></li> 

      <li><a href="" class="choice">Jokes</a></li> 


     <li class="dropdown"> 
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Categories <span class="caret"></span></a> 
      <ul class="dropdown-menu"> 
      <li><a href="" class="choice">LifeProTips</a></li> 
      <li><a href="" class="choice">TV</a></li> 
      <li><a href="" class="choice">worldnews</a></li> 
      </ul> 
     </li> 
     </ul> 


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


</body> 
+0

你在控制台中看到的任何错误? - 你也可以形容:“不会工作”多一点?什么不工作? – ochi

+1

你包含太多文件。 – j08691

+1

你不需要包含'.min.css'和'.css';它们都包含相同的东西。一些以'.min.js'和'.js','.min.css.map'和'.css.map'(我不认为你反正需要的'.map'文件) –

回答

0

变化

<link href="css/bootstrap.min.css" rel="stylesheet"> 
<link href="css/bootstrap.css" rel="stylesheet"> 
<link href="css/bootstrap.css.map" rel="stylesheet"> 
<link href="css/bootstrap.min.css.map" rel="stylesheet"> 
<link href="css/bootstrap-theme.css" rel="stylesheet"> 
<link href="css/bootstrap-theme.css.map" rel="stylesheet"> 
<link href="css/bootstrap-theme.min.css" rel="stylesheet"> 
<link href="css/bootstrap-theme.min.css.map" rel="stylesheet"> 

<script src="js/bootstrap.js"></script> 
<script src="js/bootstrap.min.js"></script> 

<link href="css/bootstrap.min.css" rel="stylesheet"> 
<link href="css/bootstrap-theme.min.css" rel="stylesheet"> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
<script src="js/bootstrap.min.js"></script> 

正如在评论中提到,你不需要同时加载的.min,而不是.min文件,并且根本不需要加载.map文件。

您可以切换到必要时进行调试使用文件的非.min版本。

+0

我只是改变它到这个和下降不菜单仍然doesn 't drop down – benji8

+0

为jquery添加了一个脚本。将其替换为本地副本 - 再次,只包含.min或非.min – Dave

0

我不得不做的是包括jQuery的

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 

,瞧它的工作