Minimalist Sidebar Offcanvas Menu Plugin With jQuery - asidebar
| File Size: | 6.54 KB |
|---|---|
| Views Total: | 7583 |
| Last Update: | |
| Publish Date: | |
| Official Website: | Go to website |
| License: | MIT |
asidebar is a super tiny jQuery plugin used to create an off-canvas sidebar navigation / menu / panel for your web application. Also provided as a React component which can be used in your modern React.js applications. The plugin uses CSS3 transitions for smooth animations when the sidebar opens / closes.
How to use it:
1. Create the off-canvas sidebar navigation with a close button.
<div class="aside">
<div class="aside-header">
Sidebar Navigation
<span class="close" data-dismiss="aside" aria-hidden="true">×</span>
</div>
<div class="aside-contents">
<p>Sidebar Content</p>
</div>
</div>
2. Create a 'aside-backdrop' element for the fullscreen background overlay when the sidebar navigation is opened.
<div class="aside-backdrop"></div>
3. Create a trigger element to toggle the sidebar navigation.
<a href="#" onclick="$('.aside').asidebar('open')">Toggle</a>
4. Style the sidebar navigation whatever you like.
.aside {
min-width: 350px;
width: 15%;
position: fixed;
top: 0;
left: 0;
bottom: 0;
background-color: #fafafa;
border-right: 1px solid #333;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
z-index: 2000;
width: 0px;
min-width: 0px;
overflow: hidden;
transition: 0.35s width ease, 0.35s min-width ease;
}
.aside .aside-header {
background-color: red;
padding: 1em;
padding-left: 0.5em;
border-bottom: 1px solid #c20000;
font-size: 1.2em;
color: black;
}
.aside .aside-header .close {
float: right;
cursor: pointer;
}
.aside .aside-contents {
padding: 0.5em;
padding-bottom: 1em;
}
.aside.in {
width: 15%;
min-width: 350px;
}
.aside-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000;
transition: 0.2s opacity ease;
opacity: 0;
display: none;
}
.aside-backdrop.in {
display: block;
opacity: 0.5;
}
5. Place jQuery library and the core JavaScript file asidebar.jquery.js at the end of the document. That's it.
<script src="//code.jquery.com/jquery-3.0.0.min.js"></script> <script src="js/jquery/asidebar.jquery.js"></script>
This awesome jQuery plugin is developed by 1egoman. For more Advanced Usages, please check the demo page or visit the official website.











