Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Twitter Bootstraps mobile navbar to overlay the content on the page instead of pushing it down?

I'm using Twitter Bootstrap and would like to modify the mobile navbar so that when it is expanded the dropdown menu overlays the content on the page instead of pushing it down. I know I will probably need to make the menu containing <div> positioned absolutely, increase it's z-index, and position the outer <div> relatively, but I can't seem to get it to work.

Any suggestions as to how I might do this?

Here's a JSFiddle I'm starting from.

like image 812
kf0l Avatar asked Aug 15 '12 14:08

kf0l


2 Answers

If you add a class like navbar-absolute to your navbar:

<div class="navbar navbar-fixed-top navbar-absolute">...</div>

, and a couple of CSS rules:

@media (max-width: 979px) {
  .navbar-fixed-top.navbar-absolute {
    position: absolute;
    margin: 0;
  }
}

.navbar-absolute + div {
    margin-top: 68px;
}

​It should get you started.

JSFiddle

like image 155
merv Avatar answered Nov 14 '22 18:11

merv


it is simple just give "navbar-fixed-top" it will automaticaly overlay all the other contents

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

like image 5
cr7 aj7 Avatar answered Nov 14 '22 17:11

cr7 aj7