2013-05-01 172 views
2

我正在調整Twitter的Bootstrap到我的Ruby on Rails教程項目(由​​Michael Hartl編寫),而上部導航並未崩潰。Twitter Bootstrap:導航欄按鈕沒有顯示或切換摺疊

目前我得到這個:

enter image description here

我的最終目標是:

enter image description here

我複製並粘貼到start_template.html礦井,確保了所有正確的bootstrap.css和js文件都被引用,並且不知道如何解決這個問題。

我home.html的粘貼以下(道歉,如果這是太多的代碼):

<title> Project Name</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

    <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap.css" rel="stylesheet"> 

    <link href="http://twitter.github.io/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet"> 

    <link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" /> 
<link href="/assets/custom.css?body=1" media="all" rel="stylesheet" type="text/css" /> 
<link href="/assets/static_pages.css?body=1" media="all" rel="stylesheet" type="text/css" /> 

    <meta content="authenticity_token" name="csrf-param" /> 
<meta content="khAXbodB/h2ghLK1iZlFZIU6RtxF1kv//qsyrJVszlE=" name="csrf-token" /> 



<div class="navbar navbar-inverse navbar-fixed-top"> 
    <div class="navbar-inner"> 
    <div class="container"> 
     <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     </button> 

     <a class="brand" href="#">Project Name</a> 

     <div class="nav-collapse collapse"> 
     <ul class="nav"> 
      <li> <a href="/">Home</a> </li> 
      <li><a href="/about">About</a></li> 
      <li> <a href="/help">Help</a> </li> 
      <li> <a href="#">Sign In</a> </li> 
     </ul> 
     </div> 
    </div> 
    </div> 
</div> 



    <div class="container-fluid"> 
     <div class="center hero-unit"> 
<h1>Project Name</h1> 
<h2>Subheader and more info</h2> 

    <a href="#" class="btn btn-large btn-primary">Sign Up Now!</a> 
</div> 


     <script src="/assets/jquery.js?body=1" type="text/javascript"></script> 
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-alert.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-button.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-carousel.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-collapse.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-dropdown.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-modal.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-popover.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-scrollspy.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-tab.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-tooltip.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-transition.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap-typeahead.js?body=1" type="text/javascript"></script> 
<script src="/assets/bootstrap.js?body=1" type="text/javascript"></script> 
<script src="/assets/static_pages.js?body=1" type="text/javascript"></script> 
<script src="/assets/application.js?body=1" type="text/javascript"></script> 

</div> 

回答

2

啓動代碼似乎做工精細.. http://bootply.com/60444

我的猜測是,東西/資產/ custom.css或/assets/application.css正在搞亂Bootstrap'navbar-fixed-top'。

你可以嘗試在這些之後加上'bootstrap-responsive.css',看看它是否有所作爲。

+0

謝謝!那就是訣竅:) – 2013-05-01 22:03:34

1

我知道不應該在提交可接受的答案後添加評論。但我真的很想分享我解決問題的方式,以防將來對某人有用。 由於某些原因,使用class「container」會禁止在摺疊狀態下顯示按鈕,而使用class =「container-fluid」時,會出現此按鈕。 真的,很奇怪。

相關問題