Bootstrap导航栏切换不会返回

时间:2014-12-16 17:23:35

标签: javascript ruby-on-rails twitter-bootstrap

这是我的_header.html.erb。 当我调整浏览器窗口的大小时,会出现切换按钮。当我点击它时,会出现折叠菜单。当我再次点击它时没有任何反应。

如何切换回来?

<nav class="navbar navbar-default navbar-fixed-top navbar-sm" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="/">Brand</a>
    </div>
    <div class="collapse navbar-collapse" id="navbar">
      <ul class="nav navbar-nav navbar-right">
        <% if user_signed_in? %>
          <li>
            <%=link_to current_user do %>
              Logged in as <strong><%= current_user.username %></strong>
              <% end %>
          </li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Actions <span class="caret"></span></a>
            <ul class="dropdown-menu" role="menu">
              <li>
                <%=link_to "Profile", current_user %>
              </li>
              <li>
                <%=link_to "Account settings", edit_user_registration_path %>
              </li>
              <li class="divider"></li>
              <li>
                <%=link_to "Logout", destroy_user_session_path, method: :delete %>
              </li>
            </ul>
          </li>
          <% else %>
            <li>
              <%=link_to "Sign up", new_user_registration_path %>
            </li>
            <li>
              <%=link_to "Login", new_user_session_path %>
            </li>
          <% end %>
      </ul>
    </div>
  </div>
</nav>

0 个答案:

没有答案