dropdown-menu
v0.1.1
Published
a simple dropdown menu
Downloads
19,718
Readme
Dropdown-menu
A simple dropdown-menu component.
Install
npm i dropdown-menu
Copy the css file as needed
Example
<div id="link" class="dropdown-menu-button">
click me
</div>
<div class="dropdown-menu hide">
<ul>
<li>new repository</li>
<li>New organization</li>
<div class="dropdown-menu-devider"></div>
<li>logout</li>
</ul>
</div>
var dropdown = require('dropdown-menu')
var el = document.getElementById('link')
var d = dropdown(el)
d.on('select', function (li) {
console.log(li)
})
API
dropdown(trigger, [postion], [offset])
- trigger is trigger element.
- postion is position string used for align
- offst is offset argument for align
.hide()
hide menu element.
Event
select