@vbarbarosh/menu

0.0.8 • Public • Published

A small js for making menus

Installation

npm i @vbarbarosh/menu

Using from a Browser

<script src="https://unpkg.com/@vbarbarosh/menu@0.0.8/dist/menu.js"></script>

Usage in plain JavaScript

<link href="https://unpkg.com/@vbarbarosh/menu@0.0.8/dist/theme-flat.css" rel="stylesheet">

<ul id="main" class="menu-flat">
    <li>
        File
        <ul>
            <li data-action="open">Open</li>
            <li data-action="save">Save</li>
            <li></li>
            <li data-action="exit">Exit</li>
        </ul>
    </li>
    <li>
        Edit
        <ul>
            <li data-action="undo">Undo</li>
            <li data-action="redo">Redo</li>
        </ul>
    </li>
    <li data-action="help">Help</li>
</ul>

<script src="https://unpkg.com/jquery@3.5.1/dist/jquery.js"></script>
<script src="https://unpkg.com/@vbarbarosh/menu@0.0.8/dist/menu.js"></script>
<script>
    menu(document.getElementById('main'))
    document.getElementById('main').addEventListener('click', function (event) {
        if (event.target.dataset.action) {
            console.log('click', event.target.dataset.action);
        }
    });
</script>

Links

Readme

Keywords

Package Sidebar

Install

npm i @vbarbarosh/menu

Weekly Downloads

34

Version

0.0.8

License

ISC

Unpacked Size

25.6 kB

Total Files

12

Last publish

Collaborators

  • vbarbarosh