Skip to content

Commit ecb3f9a

Browse files
committed
Passing the original event down to the function handling choice of the item on the context menu
1 parent 73bdef2 commit ecb3f9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

jquery.contextmenu.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jQuery.fn.contextPopup = function(menuData) {
3737
$.extend(settings, menuData);
3838

3939
// Build popup menu HTML
40-
function createMenu() {
40+
function createMenu(e) {
4141
var menu = $('<ul class="' + settings.contextMenuClass + '"><div class="' + settings.gutterLineClass + '"></div></ul>')
4242
.appendTo(document.body);
4343
if (settings.title) {
@@ -57,7 +57,7 @@ jQuery.fn.contextPopup = function(menuData) {
5757
}
5858
row.find('span').text(item.label);
5959
if (item.action) {
60-
row.find('a').click(item.action);
60+
row.find('a').click(function(){ item.action(e); });
6161
}
6262
} else {
6363
$('<li class="' + settings.seperatorClass + '"></li>').appendTo(menu);
@@ -71,7 +71,7 @@ jQuery.fn.contextPopup = function(menuData) {
7171
this.bind('contextmenu', function(e) {
7272

7373
// Create and show menu
74-
var menu = createMenu()
74+
var menu = createMenu(e)
7575
.show()
7676
.css({zIndex:1000001, left:e.pageX + 5 /* nudge to the right, so the pointer is covering the title */, top:e.pageY})
7777
.bind('contextmenu', function() { return false; });

0 commit comments

Comments
 (0)