JSFiddle - React, Tailwind, and code Playground
by Jeff
HTML
<a href="#" id="offcanvas-toggle" class="btn btn-xs btn-primary" data-toggle="offcanvas">Toggle Nav</a>
<div class="container-fluid">
<div class="row row-offcanvas row-offcanvas-left">
<div class=" col-xs-6 col-sm-2 sidebar-offcanvas">
<h4 class="nav-header">Scale</h4>
<div class="checkbox"><label><input type="checkbox"/> HO</label></div>
<div class="checkbox"><label><input type="checkbox"/> N</label></div>
<div class="checkbox"><label><input type="checkbox"/> O</label></div>
<h4 class="nav-header">Manufacturer</h4>
<div class="checkbox"><label><input type="checkbox"/> Accu-Cals</label></div>
<div class="checkbox"><label><input type="checkbox"/> Alloy Forms</label></div>
<div class="checkbox"><label><input type="checkbox"/> Microscale Decals</label></div>
</div>
<div class="col-sm-10">
<div class="row">
<div class="col-xs-4 col-sm-3 col-md-2">
<a href="#" class="item-thumbnail">
<img src="http://placehold.it/256" class="img-responsive"/>
</a>
</div>
<div class="col-xs-8 col-sm-9 col-md-10">
<h4 class="item-header">
<a href="#">New Haven 40' State of Maine Boxcar</a>
<small>B423</small>
</h4>
<span class="text-muted">by Accu-Cals</span><br/>
<strong>$3.00</strong><br/>
<i class="text-danger">Only 6 left in stock!</i>
</div>
</div>
<hr/>
<div class="row">
<div class="col-xs-4 col-sm-3 col-md-2">
<a href="#" class="item-thumbnail">
<img src="http://placehold.it/256" class="img-responsive"/>
</a>
</div>
<div...
CSS
html,
body {
overflow-x: hidden; /* Prevent scroll on narrow devices */
}
body {
margin-top:15px;
}
.item-header {
padding-bottom: 9px;
margin:0 0 20px;
border-bottom: 1px solid #eee;
}
.nav-header {
padding-bottom: 9px;
margin:15px 0 9px;
border-bottom: 1px solid #eee;
}
.item-thumbnail {
display: block;
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all .2s ease-in-out;
-o-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
#offcanvas-toggle {
position:fixed;
left:15px;
bottom:15px;
z-index:100;
display:none;
}
@media screen and (max-width: 767px) {
#offcanvas-toggle {
display:block;
}
.row-offcanvas {
position: relative;
-webkit-transition: all .25s ease-out;
-o-transition: all .25s ease-out;
transition: all .25s ease-out;
}
.row-offcanvas-right {
right: 0;
}
.row-offcanvas-left {
left: 0;
}
.row-offcanvas-right
.sidebar-offcanvas {
right: -50%; /* 6 columns */
}
.row-offcanvas-left
.sidebar-offcanvas {
left: -50%; /* 6 columns */
}
.row-offcanvas-right.active {
right: 50%; /* 6 columns */
}
.row-offcanvas-left.active {
left: 50%; /* 6 columns */
}
.sidebar-offcanvas {
position: absolute;
top: 0;
width: 50%; /* 6 columns */
padding-left:30px;
}
}
JavaScript
$(document).ready(function () {
$('[data-toggle="offcanvas"]').click(function () {
$('.row-offcanvas').toggleClass('active')
});
});