Giter Site home page Giter Site logo

brunodf / blooming-menu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caiogondim/blooming-menu.js

0.0 1.0 0.0 1.26 MB

:cherry_blossom: AwesomeMenu made with CSS

Home Page: https://caiogondim.github.io/blooming-menu/

License: MIT License

HTML 18.57% JavaScript 81.43%

blooming-menu's Introduction

BloomingMenu

js-standard-style Bitdeli Badge

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

constructor new BloomingMenu(opts)

Options object passed on instantiation time, e.g.:

var menu = new BloomingMenu({
  startAngle: 60,
  endAngle: 0
})
  • opts.itemsNum
    • Type: Number
    • Required: true
  • opts.startAngle
    • Type: Number
    • Default: 90
  • opts.endAngle
    • Type: Number
    • Default: 0
  • opts.radius
    • Type: Number
    • Default: 80
  • opts.itemAnimationDelay
    • Type: Number
    • Default: 0.04
  • opts.animationDuration
    • Type: Number
    • Default: 0.4
  • opts.fatherElement
    • Type: HTMLElement
    • Default: document.body
  • opts.itemWidth
    • Type: Number
    • Default: 50
  • opts.CSSClassPrefix
    • Type: String
    • Default: 'blooming-menu__'
  • opts.mainContent
    • Type: String
    • Default: '+'
  • 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 Firefox IE Opera Safari
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

blooming-menu's People

Contributors

caiogondim avatar bitdeli-chef avatar wesvetter avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.