sydcanem / bootstrap-contextmenu

Context menu plugin for Twitter's Bootstrap framework
http://sydcanem.com/bootstrap-contextmenu/
645 stars 193 forks source link

Adding a callback to be called before contextmenu to be open #47

Closed renanborgez closed 10 years ago

renanborgez commented 10 years ago

That what the title say, a new callback before the contextmenu appears. Very usefull when we need show/hide menu itens when right click on some kinds of elements

sydcanem commented 10 years ago

How is this different from using the options.before ?

renanborgez commented 10 years ago

beforeOpen is called when plugin is ready, then i can manipulate it too, and is called before the elements show, so i can ready properties of any element from plugin, like any custom attribute, "data-anything".

In my case i'm using it to use a callback to hide contextmenu LI item, cuz only some items can receiv some types of contextmenu.

i create it on a similar plugin, you can take a look into http://renanborges.com/wcontextmenu/

sydcanem commented 10 years ago

This is what before callback is supposed to do. FYI, you can cancel opening in before, manipulate elements before menu opens.