Reputation: 2453
I'm using a Bootstrap theme (from wrapbootstrap.com) with a Rails application, and the navbar is not acting responsively for some reason. The CSS is working for everything else except the responsive navbar.
With a traditional html file, it works fine but when I include it in a Rails layout (as seen below) it is not responsive and does not show the jQuery drop-down menu you traditionally see aligned to the right.
Here's how I'm including the js and css in the head of my layout, employees.html.erb
<%= stylesheet_link_tag "scaffolds.css.css", :media => "all" %>
<%= stylesheet_link_tag "bootstrap-responsive", :media => "all" %>
<%= stylesheet_link_tag "bootstrap-responsive.min", :media => "all" %>
<%= stylesheet_link_tag "bootstrap", :media => "all" %>
<%= stylesheet_link_tag "bootstrap.min", :media => "all" %>
<%= stylesheet_link_tag "main", :media => "all" %>
<%= stylesheet_link_tag "style", :media => "all" %>
<%= javascript_include_tag "bigvideo" %>
<%= javascript_include_tag "bootstrap" %>
<%= javascript_include_tag "bootstrap.min" %>
<%= javascript_include_tag "jquery-1.7.2.min" %>
<%= javascript_include_tag "jquery-ui-1.8.22.custom.min" %>
<%= javascript_include_tag "jquery.imagesloaded.min" %>
<%= javascript_include_tag "modernizr-2.5.3.min" %>
<%= javascript_include_tag "video" %>
Here's the navbar html that's in the body:
<!-- Navbar -->
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a 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>
</a>
<a class="brand scroller" href="index.html">Company Name</a>
<div class="nav-collapse collapse">
<ul class="nav pull-right">
<li><a href="#" class="scroller" data-section="#about">ABOUT</a></li>
<li><a href="#" class="scroller" data-section="#process">PROCESS</a></li>
<li><a href="#" class="scroller" data-section="#team">TEAM</a></li>
<li><a href="#" class="scroller" data-section="#services">SERVICES</a></li>
<li><a href="#" class="scroller" data-section="#contact">CONTACT</a></li>
</ul>
</div>
</div>
</div>
</div>
Any thoughts or suggestions regarding why the navbar is not acting responsively based on how the CSS and JS are included is very much appreciated.
Upvotes: 0
Views: 1436
Reputation: 5206
Firstly, You don't need to add bootstrap (css and js files) twice, for example:
<%= stylesheet_link_tag "bootstrap-responsive", :media => "all" %>
<%= stylesheet_link_tag "bootstrap-responsive.min", :media => "all" %>
In this case bootstrap-responsive
is the same that bootstrap-responsive.min
but minified.
Secondly, try adding bootstrap responsive after bootstrap, maybe you are overriding some "responsive" styles:
<%= stylesheet_link_tag "bootstrap", :media => "all" %>
<%= stylesheet_link_tag "bootstrap-responsive", :media => "all" %>
Hope this helps!
Upvotes: 1