Drawer open
Currently: v3.2.2
<!-- drawer.css -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/drawer/3.2.2/css/drawer.min.css">
<!-- jquery & iScroll -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/iScroll/5.2.0/iscroll.min.js"></script>
<!-- drawer.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/drawer/3.2.2/js/drawer.min.js"></script>
if you use the Package Managers.
<body class="drawer drawer--left">
<header role="banner">
<button type="button" class="drawer-toggle drawer-hamburger">
<span class="sr-only">toggle navigation</span>
<span class="drawer-hamburger-icon"></span>
</button>
<nav class="drawer-nav" role="navigation">
<ul class="drawer-menu">
<li><a class="drawer-brand" href="#">Brand</a></li>
<li><a class="drawer-menu-item" href="#">Nav1</a></li>
<li><a class="drawer-menu-item" href="#">Nav2</a></li>
</ul>
</nav>
</header>
<main role="main">
<!-- Page content -->
</main>
</body>
$(document).ready(function() {
$('.drawer').drawer();
});
$('.drawer').drawer({
class: {
nav: 'drawer-nav',
toggle: 'drawer-toggle',
overlay: 'drawer-overlay',
open: 'drawer-open',
close: 'drawer-close',
dropdown: 'drawer-dropdown'
},
iscroll: {
// Configuring the iScroll
// https://github.com/cubiq/iscroll#configuring-the-iscroll
mouseWheel: true,
preventDefault: false
},
showOverlay: true
});
Drawer toggle button
<button type="button" class="drawer-toggle">Drawer toggle</button>
$('.drawer').on('drawer.opened', function(){});
$('.drawer').on('drawer.closed', function(){});
$('.drawer').drawer('open');
$('.drawer').drawer('close');
$('.drawer').drawer('toggle');
$('.drawer').drawer('destroy');
Requires a browser that supports CSS3.