N
N
Nikita2016-11-24 15:34:24
Ruby on Rails
Nikita, 2016-11-24 15:34:24

Why is collaps not working in bootstrap?

There is this simple code:

%nav{role:'navigation', class:'navbar navbar-inverse'}
      %div{class: 'container'}
        %div{class: 'navbar-header'}
          = button_tag(type: 'button', class: 'navbar-toggle collapsed',
            data: { target: '#navbarCollapse', toggle: 'collapse' }) do
            %span{class: 'sr-only'}Toggle navigation
            %span{class: 'icon-bar'}
            %span{class: 'icon-bar'}
            %span{class: 'icon-bar'}
          = link_to 'Some title', '#', class: 'navbar-brand'
        %div{id: 'navbarCollapse', class: 'navbar-collapse collapse'}
          %ul{class: 'nav navbar-nav'}
            %li= link_to 'Help', '#'
            %li= link_to 'About Us', '#'
            %li= link_to 'Some text 1', '#'
            %li= link_to 'Some text 2', '#'

At resolution < 768, the menu icon appears as it should (it works), but when you click on it, the menu does not expand. Correct what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikita, 2016-11-24
@niks123123

The problem was due to the fact that in the file " application.js " I forgot to write:
//= require bootstrap-sprockets

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question