Question

I'm trying to integrate this plugin into my app: https://github.com/mar10/jquery-ui-contextmenu/blob/master/jquery.ui-contextmenu.js

I'm completely baffled as to how right-clicking an element that matches the delegate selector on an initialized element ends up firing the 'contextmenu' event on the bound element... I've been reading this code for HOURS and I'm still not seeing anything like:

ui.target.on('right-click', opt.selector, function(){ this._tigger('contextmenu')});

or something along those lines.. I see no references to event.which() (for mouse button detection) etc..

I can see the custom "contextmenu" event being bound to the delegate on line 79, but I'm not seeing anywhere in the code that shows how this custom even actually gets FIRED upon right-clicking an element...

Since I can't see any triggering code.. I'm assuming the jQuery-UI widget factory is somehow "automagically" doing the triggering.. but that still begs the question, how is this plugin telling the jquery-ui framework, "use right click event as my 'trigger'"??

how in the world is this working????? PLEASE HELP!

Was it helpful?

Solution

The plugin isn't listening for click events, it's listening for the oncontextmenu event which fires whenever the context menu is triggered, which most of the time is whenever something is right clicked

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top