简体   繁体   English

Twitter Bootstrap 3固定的导航栏在水平模式下折叠

[英]Twitter Bootstrap 3 fixed navbar collapse in horizontal mode

Update: So, I totally misdiagnosed the problem. 更新:所以,我完全误诊了问题。 Looks like the collapse work fine as it should collapse on @grid-float-breakpoint which is set to @screen-sm-min but for some reason navbar is now collapsed in horizontal mode by default. 看起来折叠工作正常,因为它应该在设置为@ screen-sm-min的@ grid-float-breakpoint上折叠,但是由于某种原因,导航栏现在默认情况下在水平模式折叠 Which is what I am debugging right now. 这是我现在正在调试的内容。

The navbar collapse works fine on most resolutions. 导航栏折叠在大多数分辨率下都可以正常工作。 It collapse fine on extra small devices and shows up as expected on medium and large devices. 在超小型设备上,它可以正常崩溃,并且在大中型设备上可以正常显示。 but not for small resolutions such as an iPad (1024×768), the bar collapse but the icon doesn't show up!!! 但是对于iPad(1024×768)之类的小分辨率分辨率不是这样,该栏会折叠,但图标不会显示!

Here is my code: 这是我的代码:

<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-inverse-collapse">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand"><img src='assets/logo.png'/></a>
  </div>
    <div class="navbar-inverse-collapse collapse">
      <ul class="nav navbar-nav">
        <li><%= link_to("Games", games_path) unless current_page?(games_path) %></li>
      </ul>
      <form class="navbar-form navbar-right global-search">
          <input type="text" id="global-search" class="form-control col-lg-8" placeholder="Instant search">
      </form>
    </div><!--/.nav-collapse -->
</div>

Any idea why this is happening? 知道为什么会这样吗? Using tbs 3.2.0 on a Ruby on Rails 4.1 application 在Ruby on Rails 4.1应用程序上使用tbs 3.2.0

When the navbar collapse the icon is 'removed'. 导航栏折叠时,图标被“删除”。 Instead u see 3 lines(the default collapsed navbar icon) if u change that particular icon it will show up instead of the lines 相反,如果您更改特定图标,则会看到3行(默认折叠的导航栏图标),它将代替行显示

So, I figured out my issue. 所以,我想出了我的问题。 The collapsed area didn't have the "navbar-collapse" class in it which was needed for collapse to function properly. 收合区域中没有“ navbar-collapse”类,该类需要收合才能正常运行。 So instead of: 所以代替:

<div class="navbar-inverse-collapse collapse">

It should have been: 应该是:

<div class="navbar-inverse-collapse navbar-collapse collapse">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM