sydcanem / bootstrap-contextmenu

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

More than one context menu can be visible at once #68

Open rcameron-oculus opened 9 years ago

rcameron-oculus commented 9 years ago

If I annotate two divs with data-toggle="context" but point data-target at two different context menus, I can get both menus to show simultaneously by right clicking each div in succession. Note Bootstrap's implementation of Dropdowns, for example: http://getbootstrap.com/javascript/#dropdowns. In their docs, "Note: The data-toggle="dropdown" attribute is relied on for closing dropdown menus at an application level, so it's a good idea to always use it."

Is this by design? If so, perhaps a plugin-level option to allow only one context menu to be visible at any time is in order. I'll end up solving this in application code if what I'm suggesting is undesirable.

Thank you very much for your work on this plugin--it saved us valuable time in a crunch situation!

sydcanem commented 9 years ago

Yeah, it was designed to be that way. Sorry about that.

A plugin level option to open only one instance is a good solution though. I'll add it as a feature for next iteration

rcameron-oculus commented 9 years ago

Thanks, James!

k0pernikus commented 9 years ago

:+1:

okendoken commented 9 years ago

:+1:

Nessiahs commented 9 years ago

:+1:

jayquest commented 9 years ago

i use this on the line 49:

$('[data-toggle="context"]').each(function(){ $(this).contextmenu('closemenu', e); });

as workaround while the solution don´t come...

pgyf commented 8 years ago

@jayquest Very nice