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!
Aucun commentaire:
Enregistrer un commentaire