Search code examples
javascriptcssjasny-bootstrap

Jasny bootstrap Off Canvas menu: how to force menu slide under the navbar?


I want to add static (not movable) header to the off canvas push menu.

here is what I have for now: codePen link

<span>This text should not move</span>

<div class="navmenu navmenu-default navmenu-fixed-left offcanvas">
      <a class="navmenu-brand" href="#">Project name</a>
      <ul class="nav navmenu-nav">
        <li><a href="../navmenu/">Slide in</a></li>
        <li class="active"><a href="./">Push</a></li>
        <li><a href="../navmenu-reveal/">Reveal</a></li>
        <li><a href="../navbar-offcanvas/">Off canvas navbar</a></li>
      </ul>
    </div>

    <div class="navbar navbar-default"> -------------------- navbar should not move -----------------------
      <button type="button" class="navbar-toggle" data-toggle="offcanvas" data-target=".navmenu" data-canvas=".container">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>

    <div class="container">
        <h1>Content that should move. Menu should slide from the left side UNDER the navbar</h1>
    </div>

the problem is that I don't know how to force menu slide under the 'navbar'. Any ideas?


Solution

  • You need to add top:120px to make it appear below the navbar

    .navmenu-fixed-left, .navmenu-fixed-right, .navbar-offcanvas {
      position: fixed;
      z-index: 1050;
      top: 120px;
      bottom: 0;
      overflow-y: auto;
      border-radius: 0;
    }
    

    DEMO