2.2.1 • Published 4 years ago

menu-breaker v2.2.1

Weekly downloads
13
License
MIT
Repository
github
Last release
4 years ago

menu-breaker.js

NPM version NPM downloads

About

Demo

See plugin in action

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:

<script src="/path/to/menu-breaker.js"></script>

ES6 import:

import MenuBreaker from 'menu-breaker';

Or CommonJS:

const MenuBreaker = require('menu-breaker');

Next use library with:

Vanilla JavaScript e.g:

const elem = document.querySelector('.desktop');

const menuBreaker = new MenuBreaker({
  element: elem,
  settings: {
    // options...
  },
  callbacks: {
    // callbacks...
  }
});

or jQuery e.g:

Connect jQuery in HTML

<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

or include via command line and CommonJS

$ npm install jquery
$ yarn add jquery
$ bower install jquery
const jQuery = require('jquery');

and call plugin on element

$('.desktop').menuBreaker({
  settings: {
    // options...
  },
  callbacks: {
    // callbacks...
  }
});

Options

Settings

NameTypeDefaultDescriptionAvailable options
navbar-heightnumber70Desktop menu heighte.g: 50, 86, etc.
open-classstringopenName of the class added to the mobile menu after clicking open or open-close elementName of class

Callbacks

NameDescriptionAvailable options
onInitCallback on plugin init() => { /* code */ }
onMenuOpenCallback on mobile menu open() => { /* code */ }
onMenuCloseCallback on mobile menu close() => { /* code */ }
isMobileCallback when is mobile menu() => { /* code */ }
isDesktopCallback when is desktop menu() => { /* code */ }

License

This project is licensed under the MIT License © 2018-present Jakub Biesiada

2.2.1

4 years ago

2.2.0

4 years ago

2.1.0

4 years ago

2.0.2

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

2.0.0-beta.1

5 years ago

1.1.5-beta.1

5 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.1-beta.1

6 years ago

1.1.0

6 years ago

1.1.0-rc.1

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

1.0.0-beta.2

6 years ago