2016-05-22 210 views
0

這裏是我的標記,我完全按照bootstrap文檔,但我不知道菜單爲什麼不崩潰。歡迎任何幫助bootstrap手機崩潰導航不工作

<!-- Navigation --> 
<nav class="navbar navbar-default navbar-custom navbar-fixed-top" role="navigation"> 
    <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="index.html"><img src="#" alt="Lundan On The Beat Logo"></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 navbar-right"> 
     <li class="nav-item"><a href="#home" class="active">Home</a></li> 
     <li class="nav-item"><a href="#services">Services</a></li> 
     <li class="nav-item"><a href="#gallery">Gallery</a></li> 
     <li class="nav-item"><a href="#contact">Contact</a></li> 
    </ul> 
</div> 

+0

從'id =「#bs-example-navbar-collapse-1」'中移除散列。散列只在'data-target'屬性中需要 – mfink

+0

我做了這個改變,仍然沒有運氣。我不知道問題是什麼 – JET

+0

你是否在bootstrap.js之前包括jQuery? – mfink

回答

0

試試這個。 Jsfiddle:https://jsfiddle.net/DTcHh/20842/

<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="index.html"><img src="#" alt="Lundan On The Beat Logo"></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 navbar-right"> 
     <li class="nav-item"><a href="#home" class="active">Home</a></li> 
     <li class="nav-item"><a href="#services">Services</a></li> 
     <li class="nav-item"><a href="#gallery">Gallery</a></li> 
     <li class="nav-item"><a href="#contact">Contact</a></li> 
     </ul> 
    </div><!-- /.navbar-collapse --> 
    </div><!-- /.container-fluid --> 
</nav> 
+0

當我複製並粘貼代碼時,我錯過了那些結束標記,仍然沒有運氣=( – JET