Bootstrap - 修改折叠导航栏宽度阈值? (使用宝石)

时间:2014-05-28 20:24:39

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

我使用bootstrap-sass gem 3.1在Rails 4上(所以,我没有使用LESS - 使用SASS!)。

我的麻烦是我的Bootstrap导航栏不会很快崩溃。由于额外的导航项目,我需要它在830到850像素左右折叠,而不是,我认为,767。

将其插入我的application.css.scss不起作用:

$navbarCollapseWidth: 850px;
@import "bootstrap";

这两个都没有:

$grid-float-breakpoint: 850px;
@import "bootstrap";

从我正在阅读的内容来看,grid-float-breakpoint是一个LESS变量,我不确定这是否是SASS等价物。有谁知道如何使用兼容SASS的宝石修改此阈值?谢谢!

编辑:完整的导航栏代码,如果这有帮助:

<nav class="navbar navbar-default" role="navigation">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <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="#">Site Name</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><%= link_to "Home", root_path %></li>
        <li><%= link_to "About", about_path %></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Rules<b class="caret"></b></a>
            <ul class="dropdown-menu">
              <% @awards.each do |award| %>
                <li><%= link_to award.name, award %></li>
              <% end %>
            </ul>
        </li>
        <li><%= link_to "How to Submit", instructions_path %></li>
        <li><%= link_to "Contact Us", contact_path %></li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <% if signed_in? %>
          <li><%= link_to "My Submissions", submissions_path %></li>
          <li class="dropdown">
            <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Account<b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><%= link_to "Account Profile", user_path(current_user.id) %></li>
              <li><%= link_to "Change Password", edit_user_registration_path %></li>
              <% if current_user.admin? == true %>
                <li class="divider"></li>
                <li><%= link_to "Admin Dashboard", admin_root_path %></li>
              <% end %>
              <% if current_user.judge? == true %>
                <li class="divider"></li>
                <li><%= link_to "Judge Dashboard", scores_path %></li>
              <% end %>
              <li class="divider"></li>
              <li><%= link_to "Sign Out", destroy_user_session_path, method: :delete %></li>
            </ul>
          </li>
        <% else %>
          <li><%= link_to "Create an Account", new_user_registration_path %></li>
          <li><%= link_to "Sign In", new_user_session_path %></li>
        <% end %>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

1 个答案:

答案 0 :(得分:0)

你准备在移动设备上崩溃吗? 是这样你可以尝试添加这个:

<meta name="viewport" content="width=device-width, initial-scale=1.0">

它将在移动设备上正确呈现。

Reference