1.0.5 • Published 5 years ago
simple-dropdown-menu v1.0.5
Simple dropdown menu
It's simple dropdown menu
Installation
npm install simple-dropdown-menu
Usage
JS
import Dropdown from "simple-dropdown-menu";
new Dropdown();
Now you can pass the names of eventlisteners that will show or hide the menu.
new Dropdown({listenerEnter: 'click', listenerLeave: 'mouseout'});
HTML
- Add attribute to button for dropdown - data-dropdown-menu="{THIS_YOURS_ID_BLOCK_FOR_SHOW}"
- And add\change ID block for showing
Simple:
<a data-dropdown-menu="category-dropdown">...</a>
<a data-dropdown-menu="category-dropdown" data-dropdown-menu-listener-enter="{MOUSE_EVENT}">...</a>
<a data-dropdown-menu="category-dropdown" data-dropdown-menu-listener-leave="{MOUSE_EVENT}">...</a>
<div id="category-dropdown">...</div>
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
MIT