2016-11-02 62 views
0

所以我有這段代碼(數據切換和數據目標是在我的n ++黑色也我用數據目標,而不是數據目標,它顯示我紅色..)爲什麼Bootstrap-data-toggle工作不正常?

我想讓我的網頁響應面向移動用戶和大型桌面用戶。 但是當我放大顯示屏時,在右上角有一個應該打開下拉菜單的按鈕,但是它沒有。

<html> 
<head> 
    <title>Built your Website</title> 
    <meta charset="UTF-8"> 

    <link rel="stylesheet" href="style.css"> 

    <!--jQuery library --> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> 

    <!-- Latest compiled JavaScript --> 
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> 

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 

</head> 


<nav> 

    <nav class="navbar navbar-default navbar-static-top"> <!-- color, statisch--> 
     <div class="container"> 

       <div class="navbar-header"> 
        <button type="button" class="navbar-toggle" data-toggle="collapse" data target=".navbar-collapse "> <!-- button, navbar mit dropmenu wenn bildschirm zu klein--> 

        <span class="sr-only">Toggle navigation</span> 
        <span class="icon-bar"></span> <!-- creates 3 lines in the toggle navigation when screen too little --> 
        <span class="icon-bar"></span> 
        <span class="icon-bar"></span> 

        </button> 

       <a class="navbar-brand" href="index.php">TAIL 
       <!-- <span class="glyphicon glyphicon-home" id="homeIcon"></span> --> 
       </a> 

       </div> 



        <div class="navbar-collapse collapse"> 
         <ul class="nav navbar-nav navbar-left"> 
          <!--<li><a class="navbar-brand" href="index.php">TAIL</a></li>--> 
          <li class="dropdown"> <a href="templates.php" class="dropdown-toggle" data-toggle="dropdown" >Templates</a></li> 
          <li class="dropdown"> <a href="pricing.php" class="dropdown-toggle" data-toggle="dropdown" >Pricing</a></li> 
         </ul> 

         <ul class="nav navbar-nav navbar-right"> 
          <li class="dropdown"> 
           <a href="register.php" class="dropdown-toggle" data-toggle="dropdown" >Sign Up 
           <span class="glyphicon glyphicon-user" id="sserIcon"></span> 
           </a> 
          </li> 

          <li class="dropdown"> 
           <a href="login.php" class="dropdown-toggle" data-toggle="dropdown" >Log In 
           <span class="glyphicon glyphicon-log-in" id="logIcon"></span> 
           </a> 
          </li> 
         </ul> 

        </div> 
     </div>   
    </nav> 

回答

0

你在你的代碼中缺少破折號。 取而代之的是:

data target=".navbar-collapse " 

做到這一點:

data-target=".navbar-collapse " 

然後它的作品。

+0

現在感謝它的工作! – Nenad