menu-breaker.js
About
Demo
How to Install
First, install the library in your project by npm:
$ npm install menu-breaker
Or Yarn:
$ yarn add menu-breaker
You can also connect script via one of CDNs:
bundle.run: https://bundle.run/menu-breaker
jsDelivr: https://cdn.jsdelivr.net/npm/menu-breaker/
unpkg: https://unpkg.com/menu-breaker/
Getting Started
Connect libary with project using script tag in HTML:
ES6 import:
;
Or CommonJS:
const MenuBreaker = ;
Next use library with:
• Vanilla JavaScript e.g:
const elem = document; const menuBreaker = element: elem settings: // options... callbacks: // callbacks... ;
• or jQuery e.g:
Connect jQuery in HTML
or include via command line and CommonJS
$ npm install jquery$ yarn add jquery$ bower install jquery
const jQuery = ;
and call plugin on element
;
Options
Settings
Name | Type | Default | Description | Available options |
---|---|---|---|---|
navbar-height | number | 70 |
Desktop menu height | e.g: 50 , 86 , etc. |
open-class | string | open |
Name of the class added to the mobile menu after clicking open or open-close element |
Name of class |
Callbacks
Name | Description | Available options |
---|---|---|
onInit | Callback on plugin init | () => { /* code */ } |
onMenuOpen | Callback on mobile menu open | () => { /* code */ } |
onMenuClose | Callback on mobile menu close | () => { /* code */ } |
isMobile | Callback when is mobile menu | () => { /* code */ } |
isDesktop | Callback when is desktop menu | () => { /* code */ } |
License
This project is licensed under the MIT License © 2018-present Jakub Biesiada