19

I'm using bootstrap 3.0 and working on a mobile site. I'm trying to figure out how to show and activate navbar-toggle on viewing tablet devices (Small / SM Device) because the navbar-collapse only works at Extra small devices . There is no problem while using bootstrap 2

heres my code

<nav class="navbar navbar-inverse navbar-default-top" role="navigation" style="border:0px; background:#F26522;" align="center">

    <div class="col-lg-3  col-md-3 col-sm-12" style="background-color:#fff; height:192px;" align="center" > 

<div class="hidden-xs hidden-sm"></div><a  href="#"><img src="logo_png.png"   class="img-responsive" ></a></td>
   </div>


    <div class="col-lg-9 col-md-9 col-sm-12"">
      <div class="row">
        <div class="col-lg-11 col-md-11 col-sm-12">
          <button type="button" class="navbar-toggle pull-left hidden-md hidden-lg" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only ">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> 

          <div class="collapse navbar-collapse navbar-ex1-collapse">
            <ul class="nav navbar-nav navbar-left navr">
              <li class="navrli"><a href="#" id="nav-0">ABOUT</a> </li>

            </ul>
          </div>
        </div>
        <div class="col-lg-1 col-md-1 hidden-sm" align="right">
        </div>
      </div>
    </div>
    <!-- /.navbar-collapse --> 

  <!-- /.container --> 
</nav>
user3582382
  • 193
  • 1
  • 1
  • 5

3 Answers3

18

By default, the breakpoint is @screen-sm-min (ie ≥768px).

View an Example

Customize the navbar breakpoint

To customize the navbar breakpoint, change the less variable @grid-float-breakpoint.

From the documentation:

Overflowing content

Since Bootstrap doesn't know how much space the content in your navbar needs, you might run into issues with content wrapping into a second row. To resolve this, you can:

...

c. Change the point at which your navbar switches between collapsed and horizontal mode. Customize the @grid-float-breakpoint variable or add your own media query.

You can use Bootstrap's customization tool to build a modified version of Bootstrap. From here, you can alter @grid-float-breakpoint to another breakpoint defined by Bootstrap (ie, xs, sm, md, lg) or a set amount (ie 500px).

When you're finished, navigate to the Download section, and click Compile and Download

Edit

Your markup works as expected, as well: http://jsbin.com/kuxah/1/edit?html,output

Community
  • 1
  • 1
Carrie Kendall
  • 11,124
  • 5
  • 61
  • 81
  • thanks for the help! i really appreciate :) but basically i just really need to show the navbar toggle and collapse until 991px screen. i will try to follow your suggestions :) – user3582382 Apr 28 '14 at 18:30
  • I explain how to use bootstrap's customization tool to do just that. Although LESS can be intimidating, it isn't complicated. – Carrie Kendall Apr 28 '14 at 18:31
  • 2
    If you, like me, don't like to recompile an ENTIRE bootstrap file overwriting other custom things inside of it, see this solutions which works perfectly fine, and IMO better: http://stackoverflow.com/questions/18192082/bootstrap-3-navbar-collapse – QuantumHive Apr 23 '15 at 10:12
  • If you're so coupled to a specific version of CSS @QuantumHive, say goodbye to re-usability without bloat. – Carrie Kendall Apr 23 '15 at 13:30
16

here is the solution for sassy people

@media(max-width:$screen-sm-max) {
 .navbar-header {
    float: none;
}
.navbar-left,.navbar-right {
    float: none !important;
}
.navbar-toggle {
    display: block;
}
.navbar-collapse {
    border-top: 1px solid transparent;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
    top: 0;
    border-width: 0 0 1px;
}
.navbar-collapse.collapse {
    display: none!important;
}
.navbar-nav {
    float: none!important;
    margin-top: 7.5px;
}
.navbar-nav>li {
    float: none;
}
.navbar-nav>li>a {
    padding-top: 10px;
    padding-bottom: 10px;
}
.collapse.in{
    display:block !important;
}
}
Vipul
  • 414
  • 3
  • 14
2

why to break a grid when you simply override it with media queries, e.g in sass

.navbar-toggle{  
    @media(max-width:$screen-sm-max) {
    display: block !important;
  }
}