All Projects → onokumus → Metismenujs

onokumus / Metismenujs

Licence: mit
MetisMenu: Collapsible menu plugin with Vanilla-JS

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Metismenujs

Sidr
Sidr is a jQuery plugin for creating side menus and the easiest way for doing your menu responsive.
Stars: ✭ 2,924 (+3380.95%)
Mutual labels:  plugin, menu
curved-menu
VanillaJS fully configurable curved menu (circular navigation)
Stars: ✭ 30 (-64.29%)
Mutual labels:  vanilla-js, menu
Easydropdown
A lightweight library for building beautiful styleable <select> elements
Stars: ✭ 337 (+301.19%)
Mutual labels:  menu, vanilla-js
drawer
A touch-enabled drawer component for the modern web.
Stars: ✭ 26 (-69.05%)
Mutual labels:  vanilla-js, menu
Slinky
A light-weight, responsive, mobile-like navigation menu plugin
Stars: ✭ 649 (+672.62%)
Mutual labels:  plugin, menu
Vue Rawmodel
RawModel.js plugin for Vue.js v2. Form validation has never been easier!
Stars: ✭ 79 (-5.95%)
Mutual labels:  plugin
Phantom
Phantom — 唯一零 Hook 稳定占坑类 Android 热更新插件化方案
Stars: ✭ 1,238 (+1373.81%)
Mutual labels:  plugin
Tcmenu
TcMenu is a full feature menu system for Arduino, mbed and ESP, it's modular enough to support different input types, displays and also has the concept of remote control built in.
Stars: ✭ 78 (-7.14%)
Mutual labels:  menu
Splashpublishplugin
A Splash plugin for the Publish static site generator
Stars: ✭ 79 (-5.95%)
Mutual labels:  plugin
React Planet
A react lib for building circular menus in a very easy and handy way.
Stars: ✭ 83 (-1.19%)
Mutual labels:  menu
Levelgenerator
Unity plug-in for procedurally generating indoor levels using abstract chunks.
Stars: ✭ 82 (-2.38%)
Mutual labels:  plugin
Obs Gnome Screencast
GNOME Screen Cast OBS Studio plugin
Stars: ✭ 80 (-4.76%)
Mutual labels:  plugin
Xcodecolorsense
🎈 An Xcode plugin that makes working with color easier
Stars: ✭ 79 (-5.95%)
Mutual labels:  plugin
Ngcontextmenu
Handcraft your very own context menus for a richer UX!
Stars: ✭ 81 (-3.57%)
Mutual labels:  menu
Pluginapplication
学习Android插件化必备demo
Stars: ✭ 79 (-5.95%)
Mutual labels:  plugin
Git Identity
Manage your identity in Git
Stars: ✭ 82 (-2.38%)
Mutual labels:  plugin
Awesome Typescript Ecosystem
😎 A list of awesome TypeScript transformers, plugins, handbooks, etc
Stars: ✭ 79 (-5.95%)
Mutual labels:  plugin
Tensorboard Empty Scalar Hider
Chrome Extension of hiding empty scalar/panes in TensorBoard.
Stars: ✭ 81 (-3.57%)
Mutual labels:  plugin
Magane
Bringing LINE's sticker to Discord in a chaotic way.
Stars: ✭ 81 (-3.57%)
Mutual labels:  plugin
Hidden Secrets Gradle Plugin
🔒 Deeply hide secrets on Android
Stars: ✭ 79 (-5.95%)
Mutual labels:  plugin

metismenujs NPM version NPM monthly downloads NPM total downloads

Packagist

MetisMenu: Collapsible menu plugin with Vanilla-JS

Please consider following this project's author, Osman Nuri Okumus, and consider starring the project to show your ❤️ and support.

Getting started

Install

Install with npm:

$ npm install metismenujs

Install with yarn:

$ yarn add metismenujs

Add project file to metismenu

import MetisMenu from 'metismenujs';

// or
const MetisMenu = require('metismenujs');

// create new instance
const mm = new MetisMenu('#menu', {...});

// or call MetisMenu static attach method
const mm = MetisMenu.attach('#menu', {...})

Install with composer

$ composer require onokumus/metismenujs:dev-master

Download

download

Usage

  1. Include metismenujs StyleSheet
<link rel="stylesheet" href="https://unpkg.com/metismenujs/dist/metismenujs.min.css">
<!-- OR -->  
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/metismenujs/dist/metismenujs.min.css">
  1. Include metismenujs plugin's code
<script src="https://unpkg.com/metismenujs/dist/metismenujs.min.js"></script>
<!-- OR -->
<script src="https://cdn.jsdelivr.net/npm/metismenujs/dist/metismenujs.min.js"></script>
  1. Add class metismenu to unordered list
<ul class="metismenu" id="menu">

</ul>
  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 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.

<ul class="metismenu" id="menu">
  <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>
  1. Arrow Options

add has-arrow class to a element

<ul class="metismenu" id="menu">
<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>
  1. Call the plugin:
  new MetisMenu("#menu");
  // or
  MetisMenu.attach('#menu');

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:

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

Options

toggle

Type: Boolean Default: true

For auto collapse support.

 new MetisMenu("#menu", {
   toggle: false
 });

triggerElement

Type: css selector Default: a

 new MetisMenu("#menu", {
   triggerElement: '.nav-link' // bootstrap 4
 });

parentTrigger

Type: css selector Default: li

 new MetisMenu("#menu", {
   parentTrigger: '.nav-item' // bootstrap 4
 });

subMenu

Type: css selector Default: ul

 new MetisMenu("#menu", {
   subMenu: '.nav.flex-column' // bootstrap 4
 });

API

dispose

For stop and destroy metisMenu.

 const mm = new MetisMenu("#menu");
 mm.dispose();

update

Re-init metisMenu.

 const mm = new MetisMenu("#menu");
 mm.dispose();
 // ajax ...
 mm.update();

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 v1.0.3 from v1.2.0

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

Demo

https://onokumus.com/metismenujs

Contains a simple HTML file to demonstrate metisMenu plugin.

About

Related projects

Contributing

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

Author

Osman Nuri Okumus

License

Copyright © 2020, Osman Nuri Okumus. Released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].