A configurable and animated radial menu.
BloomingMenu is a port of AwesomeMenu for the web.
Preview
Install
You can install through npm and use browserify to make it run on the browser.
npm install --save blooming-menu
Or just download the minified version
here.
Usage
Create a new BloomingMenu
object:
var menu = new BloomingMenu({
itemsNum: 8
})
Render it:
menu.render()
And now you can attach event listeners to the items of the menu, just
like a regular DOM element.
menu.props.elements.items.forEach(function (item, index) {
item.addEventListener('click', function () {
console.log('Item #' + index + 'was clicked')
})
})
API
Options object passed on instantiation time, e.g.:
var menu = new BloomingMenu({
startAngle: 60,
endAngle: 0
})
opts.itemsNum
- Type:
Number
- Required: true
opts.startAngle
opts.endAngle
opts.radius
opts.itemAnimationDelay
- Type:
Number
- Default:
0.04
opts.animationDuration
opts.fatherElement
- Type:
HTMLElement
- Default:
document.body
opts.itemWidth
opts.CSSClassPrefix
- Type:
String
- Default:
'blooming-menu__'
opts.mainContent
opts.injectBaseCSS
- Type:
Boolean
- Default:
true
Every method below is an instance method.
obj.render
Attachs the instance to the DOM and binds all event listeners.
obj.remove
Removes all DOM elements and event listeners.
obj.open
Opens the menu programmatically.
obj.close
Closes the menu programmatically.
obj.selectItem(num)
Select programatically the num
item of the menu.
Support
![Chrome](https://raw.github.com/alrra/browser-logos/master/src/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/src/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/src/archive/internet-explorer_9-11/internet-explorer_9-11_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/src/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/src/safari/safari_48x48.png) |
---|
Latest ✔ | Latest ✔ | 9+ ✔ | Latest ✔ | 8.0+ ✔ |
Donating
If you found this library useful and are willing to donate, transfer some
bitcoins to 1BqqKiZA8Tq43CdukdBEwCdDD42jxuX9UY
or through the
URL https://www.coinbase.com/caiogondim
Or via PayPal.me https://www.paypal.me/caiogondim.
Credits
caiogondim.com ·
GitHub @caiogondim ·
Twitter @caio_gondim