doushao1948 2016-06-25 17:00
浏览 63

Bootstrap左侧导航栏不会崩溃 - Wordpress

I'm having trouble with my side navbar. I'd like for it to collapse upon click of my "fa-navicon", which should be placed to the right of the menu (and above the content).

I see the div area when I inspect the element in Chrome and Firefox, but it's completely blank and unclickable.

Here's my code:

/* off-canvas sidebar toggle */
$('[data-toggle=offcanvas]').click(function() {
    $('.row-offcanvas').toggleClass('active');
    $('.collapse').toggleClass('in').toggleClass('hidden-xs').toggleClass('visible-xs');
});
html, body {
   height: 100%;
}

.wrapper, .row {
   height: 100%;
   margin-left:0;
   margin-right:0;
}

.wrapper:before, .wrapper:after,
.column:before, .column:after {
    content: "";
    display: table;
}

.wrapper:after,
.column:after {
    clear: both;
}

#sidebar {
    background-color: #eee;
    padding-left: 0;
    float: left;
    min-height: 100%;
}

#sidebar .collapse.in {
    display: inline;
}

#sidebar > .nav>li>a {
    white-space: nowrap;
    overflow: hidden;
}

#main {
    padding: 15px;
    left: 0;
}

/*
 * off canvas sidebar
 * --------------------------------------------------
 */
@media screen and (max-width: 768px) {
    #sidebar {
        min-width: 44px;
    }
    
    #sidebar .visible-xs {
       display:inline !important;
    }
    
    .row-offcanvas {
       position: relative;
       -webkit-transition: all 0.4s ease-in-out;
       -moz-transition: all 0.4s ease-in-out;
       transition: all 0.4s ease-in-out;
    }
    
    .row-offcanvas-left.active {
       left: 45%;
    }
    
    .row-offcanvas-left.active .sidebar-offcanvas {
       left: -45%;
       position: absolute;
       top: 0;
       width: 45%;
    }
} 
 
 
@media screen and (min-width: 768px) {
  .row-offcanvas {
    position: relative;
    -webkit-transition: all 0.25s ease-out;
    -moz-transition: all 0.25s ease-out;
    transition: all 0.25s ease-out;
  }

  .row-offcanvas-left.active {
    left: 3%;
  }

  .row-offcanvas-left.active .sidebar-offcanvas {
    left: -3%;
    position: absolute;
    top: 0;
    width: 3%;
    text-align: center;
    min-width:42px;
  }
  
  #main {
    left: 0;
  }
}
<script src="http://www.iamtonyalvarez.com/mysite/wp-content/themes/miami/assets/js/bootstrap.min.js"></script>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>


<!-- NAVBAR ON THE LEFT SIDE *** -->
<div class="wrapper">
  <div class="row row-offcanvas row-offcanvas-left">


    <!-- sidebar -->
    <div class="column col-sm-3 col-xs-1 sidebar-offcanvas" id="sidebar">
      <?php /* Primary navigation */
        wp_nav_menu( array(
          'menu' => 'top_menu',
          'depth' => 2,
          'container' => false,
          'menu_class' => 'nav',
          'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',  
          'walker' => new wp_bootstrap_navwalker())
        );
      ?>
    </div>
<!-- /// NAVBAR ON THE LEFT SIDE *** -->

        
    <!--! BODY WRAPPER -->
    <div class="column col-sm-9 col-xs-11" id="main">
      <div>
         <a href="#" data-toggle="offcanvas"><i class="fa fa-navicon   fa-2x"></i></a>
      </div>
      <div>
        ... Content ...
      </div>
    </div>
</div>

Here's the link to the page I'm trying to fix too: http://iamtonyalvarez.com/mysite/home-new

Can anyone advise me on what I'm doing wrong? I can't seem to figure out why the menu icon won't appear and why it won't collapse.

Your help would be much appreciated!

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥60 求一个简单的网页(标签-安全|关键词-上传)
    • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
    • ¥15 基于卷积神经网络的声纹识别
    • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
    • ¥100 为什么这个恒流源电路不能恒流?
    • ¥15 有偿求跨组件数据流路径图
    • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
    • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
    • ¥15 CSAPPattacklab
    • ¥15 一直显示正在等待HID—ISP