我的侧导航栏出现问题。我希望点击我的“fa-navicon”时它会崩溃,它应该放在菜单的右边(在内容的上方)。
当我在Chrome和Firefox中检查元素时,我看到div区域,但它完全空白且无法点击。
这是我的代码:
/* 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>
这是我正在尝试修复的页面的链接: http://iamtonyalvarez.com/mysite/home-new
有人能告诉我我做错了什么吗?我似乎无法弄清楚为什么菜单图标不会出现以及为什么它不会崩溃。
非常感谢您的帮助!