2015-01-06 97 views
0

我想用引導做一個可摺疊的導航欄,導航確實崩潰,但是當我點擊它時,它不下拉這裏是所有的代碼我有在我的索引HTML頁面bootstrap navbar崩潰沒有功能和其他問題的答案沒有工作

<!DOCTYPE html> 
<html lang="en"> 
<head> 
<meta charset="UTF-8"> 
<title>Honk</title> 
<meta name="viewport" content="width=device-width, initial-scale=1"> 
<link rel="stylesheet" href="public/stylesheets/styles.css"> 
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> 
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"> 
<link rel="stylesheet" href="public/stylesheets/custom.css"> 
</head> 
<body> 

<nav class="navbar navbar-fixed-top navbar-inverse"> 
<div class="container-fluid"> 
<div class="navbar-header"> 
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar"> 
    <span class="icon-bar"></span> 
    <span class="icon-bar"></span> 
    <span class="icon-bar"></span> 
    </button> 
     <img class="logo" src="public/images/honklogoo.png" alt=""> 
</div> 

<div class="collapse navbar-collapse" id="myNavbar"> 
    <ul class="nav navbar-nav navbar-right"> 
     <li><a class="discrip" href="#">About</a></li> 
     <li><a href="#">Commuters</a></li> 
     <li><a href="#">Travelers</a></li> 
     <li><a href="#">On Demand</a></li> 
     <li><a href="#">Safety</a></li> 
     <li><a href="#">Download</a></li> 
    </ul> 
</div> 
</div> 
</nav> 



</body> 
</html> 

回答

3

你沒有的自舉JS腳本在你的HTML(您只要有CSS)

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script> 

它在這裏工作:http://jsfiddle.net/swm53ran/26/

順便說一句,請確保你把它放在你的jquery腳本以來,因爲bootstrap依賴於jquery

+0

謝謝,我完全忽略了這一點。我覺得自己像個白癡,現在一切正常! –