Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap navbar collapse overlay menu

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.

like image 989
Imat Avatar asked Aug 06 '15 07:08

Imat


1 Answers

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>
like image 188
DavidDomain Avatar answered Sep 28 '22 11:09

DavidDomain