2017-11-25 223 views
0

我目前正在使用稱爲'儀表板'的引導程序的示例我想獲得頂部導航欄實際上藏在側面導航欄下面。喜歡這個例子:Image Example from Dribbble頂部導航欄去側面導航欄

我已經把儀表板代碼從bootstrap放到jsfiddle中,以方便那些願意幫助的用戶(我真的很感謝任何幫助)。 https://jsfiddle.net/1dy65wqx/

應該影響本:

<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"> 
    <a class="navbar-brand" href="#">Dashboard</a> 
    <button class="navbar-toggler d-lg-none" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation"> 
     <span class="navbar-toggler-icon"></span> 
    </button> 

    <div class="collapse navbar-collapse" id="navbarsExampleDefault"> 
     <ul class="navbar-nav mr-auto"> 
     <li class="nav-item active"> 
      <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Settings</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Profile</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Help</a> 
     </li> 
     </ul> 
     <form class="form-inline mt-2 mt-md-0"> 
     <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search"> 
     <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button> 
     </form> 
    </div> 
    </nav> 
</header> 

<div class="container-fluid"> 
    <div class="row"> 
    <nav class="col-sm-3 col-md-2 d-none d-sm-block bg-light sidebar"> 
     <ul class="nav nav-pills flex-column"> 
     <li class="nav-item"> 
      <a class="nav-link active" href="#">Overview <span class="sr-only">(current)</span></a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Reports</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Analytics</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Export</a> 
     </li> 
     </ul> 

     <ul class="nav nav-pills flex-column"> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Nav item</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Nav item again</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">One more nav</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Another nav item</a> 
     </li> 
     </ul> 

     <ul class="nav nav-pills flex-column"> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Nav item again</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">One more nav</a> 
     </li> 
     <li class="nav-item"> 
      <a class="nav-link" href="#">Another nav item</a> 
     </li> 
     </ul> 
    </nav> 

回答

0

我已經改變了一些款式,請添加到您的css文件..

<div class="row" style="position:relative;"> 
     <nav class="col-sm-3 col-md-2 d-none d-sm-block bg-light sidebar" style="position:fixed; z-index:2000; top:0px;">