sydcanem / bootstrap-contextmenu

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

Can I have one context menu for different sources? #71

Closed k0pernikus closed 9 years ago

k0pernikus commented 9 years ago

I have an image gallery and each item will have basically the same context menu. In the docs it is said that all events are fired on the context menu level though. Is there a way to pass the source of which element has opened the context menu into that event?

Right now, I am building in the way that each item has its own context menu and I find that a bit redundant, as I think one context menu should suffice, as long as I could differentiate from where it was opened.

If it is not possible, then please consider this a feature request to pass a source into the context menu handler.

I hope my use case is understandable and thank you very much for this plugin.

sydcanem commented 9 years ago

Check this example http://jsfiddle.net/e3Y9u/7/. It uses the scopes option to set which element should be passed on the first argument in onItem callback.

On events the context element does not get passed to the callback.