bootstrap collapse menu disappears when resizing screen

bootstrap collapse menu disappears when resizing screen

I used bootstrap menu for my app. It looks like this:

but when I change window size to smaller, it disappears – looks like this:

It disappears when its about ~965px wide (so its probably 979px). I tried this solution, didnt work. May be I’m mixing bootstrap 2 and 3?
This is my menu code:

includes:




And site (far from finished)
If I zoom in, menu disappears as well.

Solutions/Answers:

Solution 1:

If you do not want your navbar links to be collapsed on smaller devices, then you need to remove the <div class="nav-collapse collapse"> element.

The basic structure should look something like this….

<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <a class="brand" href="#">Title</a>
    <ul class="nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Link</a></li>
      <li><a href="#">Link</a></li>
    </ul>
  </div>
</div>

If you want to keep the responsive functionality, then add the below code to within you container div. This will give you a button to toggle the collapsed menu on smaller devices.

  <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
  </a>

So then the end result would look something like this.

<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">

      <!-- .btn-navbar is used as the toggle for collapsed navbar content -->
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>

      <!-- Be sure to leave the brand out there if you want it shown -->
      <a class="brand" href="#">Project name</a>

      <!-- Everything you want hidden at 940px or less, place within here -->
      <div class="nav-collapse collapse">
        <!-- .nav, .navbar-search, .navbar-form, etc -->
      </div>

    </div>
  </div>
</div>

Also, you do not have to nest a <ul class="nav"> element within a <ul class="nav"> element for the dropdown menus. The correct structure for you navigation items should look like this.

<ul class="nav">
  <li class="active"><a href="#">Home</a></li>
  <li><a href="#">Link</a></li>
  <li><a href="#">Link</a></li>
  <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
      Test
      <b class="caret"></b>
    </a>
    <ul class="dropdown-menu">
      ...
    </ul>
  </li>
</ul>

References