2.1.0 • Published 5 years ago
swibe v2.1.0
Swibe
A simple slide menu in JS
Getting started
Install the npm package:
npm install swibeAdd the basic markup
<button id="swibe-menu-trigger">Menu</button> <nav id="swibe-menu"> <ul> <li><a>Item</a></li> <li><a>Item</a></li> <li><a>Item</a></li> <li><a>Item</a></li> </ul> </nav>Import Swibe in your code, create a new instance and initialize it.
import Swibe from 'swibe'; const menu = new Swibe({}); menu.init();
You can instead load it into the HTML.
<!-- Downloaded file -->
<script src="swibe.min.js"></script>
<!-- With UNPKG -->
<script src="https://unpkg.com/swibe"></script>You can see a basic working demo in /docs/index.html
API
init(): Initialize your Swibe instanceopen(): Open the menuclose(): Close the menutoggle(): Toggle the menu
Options
import Swibe from 'swibe';
const menu = new Swibe({
transition: '200ms',
breakpoint: '960px',
enableCallback: moveMainNav,
disableCallback: restoreMainNav
});
menu.init();menuID: 'swibe-menu'| The menu IDtriggerID: 'swibe-menu-trigger'| The trigger IDwidth: '300px'| The menu widthtransition: '300ms'| Transition time to open and close the menushadowOpacity: 0.5| Shadow background opacityzIndex: 999| Menu z-index property.breakpoint: undefined| The breakpoint where menu enable or disable. (Else, is enabled everytime)disableCallback: undefined| Function that run every time that menu is disabled. (Only works if you use a breakpoint)enableCallback: undefined| Function that run every time that menu is enabled. (If don't use a breakpoint, only works one time at init)openCallback: undefined| Function that run every time that menu is openedcloseCallback: undefined| Function that run every time that menu is closed
Changelog
See Releases.
Credits
Developed by Iván Barcia
Project tested on BrowserStack
License
This project is under MIT License
2.1.0
5 years ago
2.0.0
5 years ago
2.0.0-beta.2
5 years ago
2.0.0-beta.1
5 years ago
1.2.2
6 years ago
1.2.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.2
7 years ago
1.0.1
7 years ago
1.0.0
7 years ago
1.0.0-beta.5
7 years ago
1.0.0-beta.4
7 years ago
1.0.0-beta.3
7 years ago
1.0.0-beta.2
7 years ago
1.0.0-beta.1
7 years ago