I am currently implementing Twitter Bootstrap in a Rails project, but I'm encountering issues with the responsive navbar. When I resize the screen, the menu toggle button appears along with the navbar options open below it. Upon further shrinking, the navbar options finally hide as expected. However, clicking the navbar menu toggle button has no effect. I have verified that jQuery is loaded and that I am using the latest version of Bootstrap. Below is the code snippet:
.navbar.navbar-inverse.navbar-fixed-top{ role: 'navigation', style: 'background-color:#000066' }
.container
.navbar-header
%button.navbar-toggle.pull-right{ type: 'button', data: { toggle: "collapse", target: ".navbar-ex1-collapse" } }
%span.sr-only Toggle Navigation
%span.icon-bar
%span.icon-bar
%span.icon-bar
%a.navbar-brand{ href: root_path }
%strong
L
%i.fa.fa-cog{ style: 'font-size:80%;margin:0 -2px;' }
gSMART
.collapse.navbar-collapse.navbar-ex1-collapse{ role: 'navigation' }
%ul.nav.navbar-nav.navbar-right
%li
%a{ href: root_path, class: set_css_if( path: root_path ) }
HOME
%li
%a{ href: about_path, class: set_css_if( path: about_path ) }
ABOUT
%li
%a{ href: faq_path, class: set_css_if( path: faq_path ) }
FAQs
%li
%a{ href: resources_path, class: set_css_if( path: resources_path ) }
MANUALS and RESOURCES
-if current_user
%li
%a{ href: logout_path, class: set_css_if( path: logout_path ) }
LOGOUT
-else
%li
%a{ href: login_path, class: set_css_if( path: login_path ) }
LOGIN
For more details, here are my layout page, application.js, and application.css files.
Layout:
%html{ lang: :en }
%head
%title
CogSMART
%meta{ name: "viewport", content: "width=device-width, initial-scale=1.0" }
= stylesheet_link_tag 'http://fonts.googleapis.com/css?family=Lato:300,400,700,900,300italic,400italic,700italic,900italic'
= stylesheet_link_tag "//netdna.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css"
= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true
= javascript_include_tag "application", "data-turbolinks-track" => true
= csrf_meta_tags
%body.pull_top
= render 'partials/navbar'
#coming_soon
.head
.container
.span12.text
%h4
CogSMART stands for:
%h4
Cognitive Symptom Management and Rehabilitation Therapy
app.js
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree ./clean_canvas
app.css
/*
*= require_tree ./clean_canvas_v2
*= require_self
*/