2017 © Pedro Peláez
 

library metismenu

A menu plugin

image

onokumus/metismenu

A menu plugin

  • Thursday, July 12, 2018
  • by onokumus
  • Repository
  • 113 Watchers
  • 1584 Stars
  • 26,513 Installations
  • JavaScript
  • 6 Dependents
  • 0 Suggesters
  • 388 Forks
  • 66 Open issues
  • 35 Versions
  • 8 % Grown

The README.md

metismenu NPM version NPM monthly downloads NPM total downloads

A collapsible jQuery menu plugin, (*1)

This version does not support any version of IE browser., (*2)

Getting started

Install

Install with npm:, (*3)

npm install --save metismenu

Install with yarn:, (*4)

yarn add metismenu

Install with composer, (*5)

composer require onokumus/metismenu:dev-master

Download

download, (*6)

Usage

  1. Include metismenu StyleSheet, (*7)

    <link rel="stylesheet" href="https://unpkg.com/metismenu/dist/metisMenu.min.css">
    <!-- OR -->  
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/metismenu/dist/metisMenu.min.css">
    
  2. Include jQuery, (*8)

    <script src="https://unpkg.com/jquery"></script>
    <!-- OR -->
    <script src="https://cdn.jsdelivr.net/npm/jquery"></script>
    
  3. Include metisMenu plugin's code, (*9)

    <script src="https://unpkg.com/metismenu"></script>
    <!-- OR -->
    <script src="https://cdn.jsdelivr.net/npm/metismenu"></script>
    
  4. Add id attribute to unordered list, (*10)

    ```html, (*11)

```, (*12)

  1. Make expand/collapse controls accessible

Be sure to add aria-expanded to the element a. This attribute explicitly defines the current state of the collapsible element to screen readers and similar assistive technologies. If the collapsible element is closed by default, it should have a value of aria-expanded="false". If you've set the collapsible element's parent li element to be open by default using the mm-active class, set aria-expanded="true" on the control instead. The plugin will automatically toggle this attribute based on whether or not the collapsible element has been opened or closed., (*13)

html <ul id="metismenu"> <li class="mm-active"> <a href="#" aria-expanded="true">Menu 1</a> <ul> ... </ul> </li> <li> <a href="#" aria-expanded="false">Menu 2</a> <ul> ... </ul> </li> ... </ul>, (*14)

  1. Arrow Options

add has-arrow class to a element, (*15)

html <ul id="metismenu"> <li class="mm-active"> <a class="has-arrow" href="#" aria-expanded="true">Menu 1</a> <ul> ... </ul> </li> <li> <a class="has-arrow" href="#" aria-expanded="false">Menu 2</a> <ul> ... </ul> </li> ... </ul>, (*16)

  1. Call the plugin:, (*17)

    $("#metismenu").metisMenu();
    

Stopping list opening on certain elements

Setting aria-disabled="true" in the <a> element as shown will stop metisMenu opening the menu for that particular list. This can be changed dynamically and will be obeyed correctly:, (*18)

<a href="#" aria-expanded="false" aria-disabled="true">List 1</a>

toggle

Type: Boolean Default: true, (*19)

For auto collapse support., (*20)

 $("#metismenu").metisMenu({
   toggle: false
 });

dispose

Type: String Default: null, (*21)

For stop and destroy metisMenu., (*22)

 $("#metismenu").metisMenu('dispose');

preventDefault

Type: Boolean Default: true, (*23)

Prevents or allows dropdowns' onclick events after expanding/collapsing., (*24)

javascript $("#menu").metisMenu({ preventDefault: false });, (*25)

since from version 2.7.0, (*26)

triggerElement

Type: jQuery selector Default: a, (*27)

 $("#metismenu").metisMenu({
   triggerElement: '.nav-link' // bootstrap 5
 });

parentTrigger

Type: jQuery selector Default: li, (*28)

 $("#metismenu").metisMenu({
   parentTrigger: '.nav-item' // bootstrap 5
 });

Type: jQuery selector Default: ul, (*29)

 $("#metismenu").metisMenu({
   subMenu: '.nav.flex-column' // bootstrap 5
 });

Events

Event Type Description
show.metisMenu This event fires immediately when the _show instance method is called.
shown.metisMenu This event is fired when a collapse ul element has been made visible to the user (will wait for CSS transitions to complete).
hide.metisMenu This event is fired immediately when the _hide method has been called.
hidden.metisMenu This event is fired when a collapse ul element has been hidden from the user (will wait for CSS transitions to complete).

Migrating to v3 from v2

  • Update metisMenu.js & metisMenu.css files
  • Change active class to mm-active

Demo

http://mm.onokumus.com, (*30)

Contains a simple HTML file to demonstrate metisMenu plugin., (*31)

About

Contributors

Contributor
onokumus
diegozhu
sinabs
DrugoLebowski
BurkovBA
arthurtalkgoal
mrdziuban
nicolasigot
PeterDaveHello
kalidema
AndrewEastwood
rgnevashev
719media
chriswiggins
jmagnusson
LukasDrgon
Cediddi
WoMayr
capynet

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue., (*32)

Please read the contributing guide for advice on opening issues, pull requests, and coding standards., (*33)

Release History

DATE VERSION CHANGES
2021-05-16 v3.0.7 sass support
2020-03-22 v3.0.6 fix security vulnerabilities
2019-12-28 v3.0.5 Fix dispose to be similar to init (adding event) #184
2019-03-07 v3.0.4 fix
2018-10-05 v3.0.3 fix
2018-10-05 v3.0.2 fix
2018-10-05 v3.0.1 fix
2018-10-05 v3.0.0 more functionally
2018-10-05 v2.7.9.1 Fix dispose option #173
2018-06-28 v2.7.9 Make jquery a peer dependency
2018-06-14 v2.7.8 remove aria-expanded attribute & remove transitionend check
2018-02-14 v2.7.4 jQuery -> $ in src/metisMenu.js to fix import. #158
2018-02-14 v2.7.3 window might not be defined in node.js environment #156
2017-12-31 v2.7.2 isolate against bootstrap changes, remove old legacy ie9 code #154
2017-10-30 v2.7.1 added check in complete()-callback to break when menu was disposed #150
2017-03-08 v2.7.0 fixed has-arrow class border color & added new 3 options
2017-02-23 v2.6.3 fixed #129
2017-02-02 v2.6.2 doubleTapToGo option is deprecated
2016-12-06 v2.6.1 fix require.js
2016-11-29 v2.6.0 dispose support
2016-05-06 v2.5.2 fix Menu failed to remove collapsing class
2016-05-06 v2.5.1 fixed bootstrap conflict
2016-03-31 v2.5.0 Event support
2016-03-11 v2.4.3 create meteor package
2016-03-04 v2.4.2 back to version 2.4.0
2016-03-03 v2.4.1 Transition element passed to methods (removed)
2016-01-25 v2.4.0 Support AMD / Node / CommonJS
2016-01-08 v2.3.0 Adding aria-disabled=true to the link element prevents the dropdown from opening
2015-09-27 v2.2.0 Events supported & added preventDefault options
2015-08-06 v2.1.0 RTL & aria-expanded attribute & TypeScript type definitions support
2015-07-25 v2.0.3 When the active item has doubleTapToGo should not collapse
2015-05-23 v2.0.2 fixed
2015-05-22 v2.0.1 changeable classname support
2015-04-03 v2.0.0 Remove Bootstrap dependency
2015-03-24 v1.1.3 composer support
2014-11-01 v1.1.3 Bootstrap 3.3.0
2014-07-07 v1.1.0 Add double tap functionality
2014-06-24 v1.0.3 cdnjs support & rename plugin
2014-06-18 v1.0.3 Create grunt task
2014-06-10 v1.0.2 Fixed for IE8 & IE9

Author

Osman Nuri Okumus, (*34)

License

Copyright © 2021, Osman Nuri Okumus. Released under the MIT License., (*35)

The Versions

12/07 2018

v3.x-dev

3.9999999.9999999.9999999-dev https://github.com/onokumus/metisMenu

A menu plugin

  Sources   Download

MIT

plugin css js menu web

12/07 2018

v3.0.0-beta.0

3.0.0.0-beta0 https://github.com/onokumus/metisMenu

A menu plugin

  Sources   Download

MIT

plugin css js menu web

28/06 2018

dev-master

9999999-dev https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

28/06 2018

v2.7.9

2.7.9.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

25/06 2018

v3.0.0-alpha.2

3.0.0.0-alpha2 https://github.com/onokumus/metisMenu

A menu plugin

  Sources   Download

MIT

plugin css js menu web

22/06 2018

v3.0.0-alpha.1

3.0.0.0-alpha1 https://github.com/onokumus/metisMenu

A menu plugin

  Sources   Download

MIT

plugin css js menu web

17/06 2018

v3.0.0-alpha.0

3.0.0.0-alpha0 https://github.com/onokumus/metisMenu

A menu plugin

  Sources   Download

MIT

plugin css js menu web

14/06 2018

v2.7.8

2.7.8.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

23/04 2018

v2.7.7

2.7.7.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

21/04 2018

v2.7.6

2.7.6.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

20/04 2018

v2.7.5

2.7.5.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

07/03 2018

dev-develop

dev-develop https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

16/02 2018

v2.7.4

2.7.4.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

15/02 2018

v2.7.3

2.7.3.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

31/12 2017

v2.7.2

2.7.2.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

30/10 2017

v2.7.1

2.7.1.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

12/05 2017

dev-parent-toogle

dev-parent-toogle https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

08/03 2017

v2.7.0

2.7.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

23/02 2017

v2.6.3

2.6.3.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

02/02 2017

v2.6.2

2.6.2.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

06/12 2016

v2.6.1

2.6.1.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

29/11 2016

v2.6.0

2.6.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

06/05 2016

v2.5.2

2.5.2.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

06/05 2016

v2.5.1

2.5.1.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

30/03 2016

v2.5.0

2.5.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

11/03 2016

v2.4.3

2.4.3.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

04/03 2016

v2.4.2

2.4.2.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

25/01 2016

v2.4.0

2.4.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

08/01 2016

v2.3.0

2.3.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

27/09 2015

v2.2.0

2.2.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

06/08 2015

v2.1.0

2.1.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

25/07 2015

v2.0.3

2.0.3.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

22/05 2015

v2.0.2

2.0.2.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

21/05 2015

v2.0.1

2.0.1.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web

03/04 2015

v2.0.0

2.0.0.0 https://github.com/onokumus/metisMenu

A jQuery menu plugin

  Sources   Download

MIT

plugin css jquery bootstrap js menu web