7

Im trying to replicate this navbar collapse content(please see image below)

enter image description here

As you can see, once I click the hamburger menu, the content of navbar is shown in full screen instead of sliding it down. Is there any plugin or css snippet that I could use to achieve this? Thanks for your help.

Imat
  • 500
  • 2
  • 4
  • 15
  • 2
    Difficult without code, so you might want to look here: http://stackoverflow.com/questions/3508605/how-can-i-transition-height-0-to-height-auto-using-css?page=1&tab=votes#tab-top – John Reid Aug 06 '15 at 07:57

1 Answers1

12

Instead of using the collapse value for the data-toggle attribute targeting the collapse nav-bar you can use a modal. You can style the content of the modal how ever you like.

Here is an example. I'm sure you'll get the idea.

.navbar-toggle {
  float: left !important;
  margin-left: 15px;
  margin-right: 0;
}

.modal-nav-content {
  width: 100%;
  height: auto;
}

.modal-nav-body {
  margin-top: 100px; 
}

.modal-nav-body ul {
  list-style-type: none;
  color: white;
  margin: 0;
  padding: 0;
  width: 100%;
}

.modal-nav-body ul li {
  text-align: center;
  font-size: 130%;
  padding: 8px;
  text-transform: uppercase;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">

    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="modal" data-target="#nav-modal" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>    

  </div>
</nav>

<!-- Modal -->
<div class="modal fade" id="nav-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-nav-content">
      <div class="modal-nav-body">
        <ul>
          <li>Brand</li>
          <li>Home</li>
          <li>Tour</li>
          <li>News</li>
        </ul>
      </div>
    </div>
  </div>
</div>
DavidDomain
  • 14,976
  • 4
  • 42
  • 50