supermenu

4.1.1 • Public • Published

Supermenu

Simple css-based context menu made for Cloud Commander. Little bit better then others :).

How come?

Tired to use js based libraries which use jquery and .hover classes insteed of :hover pseudo-selectors.

Install

npm i supermenu

How use?

Add little JavaScript:

const supermenu = require('supermenu');
const menu = supermenu({
    'item name': () => {},
});

// show menu on right mouse click
menu.addContextMenuListener();

You could use element and (or) options parameters if you need to.

const element = document.body;
const log = (msg) => () => console.log(msg);

const options = {
    icon: true,
    /* add class icon-item-name */
    beforeShow: log('before show'),
    afterShow: log('after show'),
    beforeHide: log('beforeHide'),
    afterHide: log('after hide'),
    beforeClick: log('before click'),
    afterClick: log('after click'),
    name: 'name of menu', /* if you want use a couple menu on one element */
};

const menu = supermenu(element, options, {
    'item name': () => {},
});

Example of multilevel menu:

const menu = supermenu({
    help() {
        alert('*help');
    },
    upload: {
        github: {
            gist() {
                alert('*gist');
            },
            main() {
                alert('*main');
            },
        },
        dropbox() {
            alert('*dropbox');
        },
    },
});

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i supermenu

Weekly Downloads

5

Version

4.1.1

License

MIT

Unpacked Size

17.7 kB

Total Files

9

Last publish

Collaborators

  • coderaiser