我有下面的代码,但下拉列表无效,有什么想法吗? 我需要添加“$('。dropdown-toggle')。dropdown();”到我的javascript文件?
.navbar.navbar-fixed-top
.navbar-inner
.container
%button.btn.btn-navbar{"data-target" => ".nav-collapse", "data-toggle" => "collapse", :type => "button"}
%span.icon-bar
%span.icon-bar
%span.icon-bar
= link_to I18n.t(:site_title), root_url, :class => "brand"
.nav-collapse
%ul.nav
%li= link_to I18n.t(:nav_thelist)
%li= link_to I18n.t(:nav_themap)
%li= link_to I18n.t(:nav_the92)
%li.dropdown
%a.dropdown-toggle{"data-toggle" => "dropdown", "data-target" => "#", :href => "#"}
= I18n.t(:nav_admin)
%b.caret
%ul.dropdown-menu
%li= link_to I18n.t(:nav_leagues), leagues_url
%li= link_to I18n.t(:nav_clubs), clubs_url
%li= link_to I18n.t(:nav_visits), visits_url
答案 0 :(得分:1)
Twitter-Bootstrap中的下拉菜单不仅需要适当的属性和CSS,还需要相应的javascript插件。点击此处确保为下拉列表安装了正确的javascript插件:
答案 1 :(得分:0)
如果您使用的是twitter-bootstrap-rails gem 它在application.js中错误地命名了require路径 将其更改为 // =需要引导程序