我有一个带有bootstrap 3的rails应用程序,菜单没有崩溃。此外,当我有时调整大小时,三个条显示崩溃菜单,但正常的菜单项仍然只是紧挨着它。这是haml提前感谢。
%nav.navbar.navbar-inverse{role: 'navigation' }
%div.container-fluid
%div.navbar-header
%button.navbar-toggle{type: 'button', 'data-toggle' => 'collapse', id: 'menu-toggler', 'data-target' => '.navbar-collapse'}
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to (image_tag 'logo.png', class: 'logo'), root_path, class: 'navbar-brand', 'data-no-turbolink' => true
%div.collapse.navbar-collapse
%ul.nav.navbar-nav.navbar-right
%li.active= link_to '<i class="icon-dashboard"></i> Dashboard'.html_safe, root_path, 'data-no-turbolink' => true
%li= link_to '<i class="icon-signout"></i> Logout'.html_safe, destroy_user_session_path, method: :delete
%li= link_to '<i class="icon-envelope"></i> Contact Us'.html_safe, new_contact_request_path
%li.dropdown
%a.dropdown-toggle{href: '#', 'data-toggle' => 'dropdown'}
%i.icon-gears
Profile
%b.caret
%ul.dropdown-menu
%li= link_to 'Manage email addresses', emails_path
%li= link_to 'Edit Account', edit_user_registration_path
%li= link_to 'Setup Wizard', setup_wizard_home_index_path
%li= link_to 'Cancel Account', cancel_account_home_index_path
答案 0 :(得分:0)
您是否在您的javascript清单中添加了//= require bootstrap
?
答案 1 :(得分:0)
在查看了bootstrap文档后,我最终做到了这一点。让下拉切换工作。仍然不确定为什么某些菜单会保持一定的大小,下拉选项会显示在旁边。
$('#nav-toggle').click(function(){
$('.collapse').collapse({ toggle: false })
});