sydcanem / bootstrap-contextmenu

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

onItem executed N times where N is the number of elements that meet the jQuery selector #22

Closed ninio closed 11 years ago

ninio commented 11 years ago

I'm attaching the context menu with ".class" selector. The onItem callback is executed N times (N= the elements that meet the jQuery selector) because for each element that meets the selector the contextmenu is individually created (:162) and therefore calls the listen function (binding the on click event).

Any recomendation how to fix this? (Except using a global binding for it with a check inside the before callback)

sydcanem commented 11 years ago

I don't exactly get what you mean. Can you show some example? jsfiddle maybe?

James Santos Software/Web Applications Developer http://sydcanem.com

On Mon, May 13, 2013 at 11:22 PM, ninio notifications@github.com wrote:

I'm attaching the context menu with ".class" selector. The onItem callback is executed N times (N= the elements that meet the jQuery selector) because for each element that meets the selector the contextmenu is individually created (:162) and therefore calls the listen function (binding the on click event).

Any recomendation how to fix this? (Except using a global binding for it with a check inside the before callback)

— Reply to this email directly or view it on GitHubhttps://github.com/sydcanem/bootstrap-contextmenu/issues/22 .

ninio commented 11 years ago

Here - http://jsfiddle.net/aM9mY/4/

Godoy commented 11 years ago

good! thanks for the solution :+1: