2017-02-12 45 views
0

用於將導航欄中的選項列表分組的摺疊選項不起作用。爲什麼摺疊選項下的導航欄不工作在bootstrap3?

請檢查HTML代碼並提供解決方案。 我希望它能夠完全響應。

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8"> 
     <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
     <meta name="viewport" content="width=device-width, initial-scale=1"> 
     <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 
     <title>TestRank</title> 

     <!-- Bootstrap --> 
     <link href="css/bootstrap.min.css" rel="stylesheet"> 
    </head> 

    <body> 
     <nav class="navbar navbar-default navbar-fixed-top"> 
      <div class="container-fluid"> 
      <div class="navbar-header"> 

       <button type="button" class="navbar-toggle" 
         data-toogle="collapse" data-target="#mynavbar"> 
        <!--<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= "Logo.png" style="width:120px; height:30px;" alt="TestRank" ></a> 
      </div> 
       <div class="navbar-collapse collapse" id="mynavbar"> 
        <ul class="nav navbar-nav navbar-right"> 
         <li><a href="index.html">Home</a></li> 
         <li><a href="About.html">About</a></li> 
         <li><a href="Features.html">Features</a></li> 
         <li><a href="Contact.html">Contact</a></li> 
        </ul> 
       </div> 
      </div> 
     </nav> 
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
     <script src ="js/bootstrap.min.js"></script> 
    </body> 
</html> 

回答

1

您曾在<button type="button" class="navbar-toggle" data-toogle="collapse" data-target="#mynavbar" aria-expanded="false">一個錯字,其中data-toogle="collapse"是錯誤的東西必須是data-toggle="collapse"

這是正確的代碼:

<nav class="navbar navbar-default navbar-fixed-top"> 
    <div class="container-fluid"> 
    <div class="navbar-header"> 

     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mynavbar" aria-expanded="false"> 
      <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= "Logo.png" style="width:120px; height:30px;" alt="TestRank" ></a> 
    </div> 

     <div class="collapse navbar-collapse" id="mynavbar"> 
      <ul class="nav navbar-nav navbar-right"> 
       <li><a href="index.html">Home</a></li> 
       <li><a href="About.html">About</a></li> 
       <li><a href="Features.html">Features</a></li> 
       <li><a href="Contact.html">Contact</a></li> 
      </ul> 
     </div> 
    </div> 
</nav> 
+0

感謝,得到了解決 – Dinesh