2015-05-12 113 views
0

我正在修復簡歷上的Bootstrap導航欄。鏈接工作,並且它固定在簡歷的頂部。從較小的屏幕查看時,Navbar切換按鈕出現,背景顏色打開關閉,反之亦然...但鏈接不切換。我檢查了多個來源,但無法弄清楚什麼是關閉的。Bootstrap響應式導航欄(鏈接不要摺疊)

任何建議表示讚賞。 謝謝。

<!DOCTYPE html> 

<head> 
    <meta charset="utf-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 


    <title>M.Gillespie Resume</title> 

    <link rel="stylesheet" href="css/bootstrap.min.css"> 
    <link rel="stylesheet" href="css/animate.css"> 
    <link href="css/style.css" rel="stylesheet" type="text/css"> 

    <script src="js/jQuery.js"></script> 
    <script src="js/helper.js"></script> 
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places"></script> 
</head> 
<body> 
    <nav class="navbar navbar-default navbar-fixed-top animated bounceInRight"> <!-- Fixed Nav Bar --> 
     <div class="navbar-header navbar-right"> 
     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse1"> 
      <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="#">Top</a> <!-- NavBar Brand --> 
     </div> 
     <div class="navbar-collapse collapse " id="navbar-collapse1"> <!-- Links to Resume Sections --> 
     <ul class="nav navbar-nav navbar-right"> 
      <li class="active, hover"><a href="#workExperience">Experience</a></li> 
      <li class="active, hover"><a href="#projects">Projects</a></li> 
      <li class="active, hover"><a href="#education">Education</a></li> 
      <li class="active, hover"><a href="#letsConnect">Connect</a></li> 
     </ul> 
     </div><!-- /.navbar-collapse --> 
    </nav> 
    <div class="container-fluid"> 
     <div id="main"> 
     <div id="header" class="center-content clearfix, animated bounceInDown"> 
      <ul id="topContacts" class='flex-box'></ul> 
     </div> 
     <div style='clear: both;'></div> 
     <div id="workExperience" class='gray, animated bounceInDown'> 
      <h2>Experience</h2> 
     </div> 
     <div id="projects" class='gray, animated bounceInDown'> 
      <h2>Projects</h2> 
     </div> 
     <div id="education" class='gray, animated bounceInDown'> 
      <h2>Education</h2> 
     </div> 
     <div id="mapDiv" class=" animated bounceInDown"> 
      <h2>Where I've Lived and Worked</h2> 
     </div> 
     <div id="letsConnect" class='dark-gray animated bounceInRight'> 
      <h2 class='orange center-text'>Let's Connect</h2> 
      <ul id="footerContacts" class="flex-box"> 
      </ul> 
     </div> 
     </div> 
    </div> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> 
    <script src="js/bootstrap.min.js"></script> 
    <script src="js/resumeBuilder.js"></script> 


    <script type="text/javascript"> 

    if(document.getElementsByClassName('flex-item').length === 0) { 
     document.getElementById('topContacts').style.display = 'none'; 
    } 
    if(document.getElementsByTagName('h1').length === 0) { 
     document.getElementById('header').style.display = 'none'; 
    } 
    if(document.getElementsByClassName('work-entry').length === 0) { 
     document.getElementById('workExperience').style.display = 'none'; 
    } 
    if(document.getElementsByClassName('project-entry').length === 0) { 
     document.getElementById('projects').style.display = 'none'; 
    } 
    if(document.getElementsByClassName('education-entry').length === 0) { 
     document.getElementById('education').style.display = 'none'; 
    } 
    if(document.getElementsByClassName('flex-item').length === 0) { 
     document.getElementById('letsConnect').style.display = 'none'; 
    } 
    if(document.getElementById('map') === null) { 
     document.getElementById('mapDiv').style.display = 'none'; 
    } 
    </script> 
</body> 
</html> 

回答

0

嘗試添加到<a href="#IDNAME">此代碼:data-toggle="collapse" data-target=".navbar-collapse"

+0

感謝您的建議MaGiO。我試過但沒有改變。感謝幫助! – Meg

+0

你可以創建一個活的代碼例子嗎?例如在codepen.io? – MaGiO