Jasny bootstrap Off Canvas菜单:如何在导航栏下强制菜单滑动?

时间:2015-04-03 09:05:49

标签: javascript css jasny-bootstrap

我想在off canvas push menu添加静态(不可移动)标题。

这就是我现在所拥有的: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>

问题是我不知道如何在“导航栏”下强制菜单滑动。 有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您需要添加top:120px才能使其显示在导航栏

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

<强> DEMO