From f617461df26a5871b509f7805c7317ac43875c30 Mon Sep 17 00:00:00 2001 From: Michele Beltrame Date: Wed, 30 Oct 2013 17:21:48 +0100 Subject: [PATCH 1/2] Callback beforeOpen toe xecute code before showing menu --- jquery.contextmenu.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jquery.contextmenu.js b/jquery.contextmenu.js index efe52b5..e511169 100644 --- a/jquery.contextmenu.js +++ b/jquery.contextmenu.js @@ -69,6 +69,10 @@ jQuery.fn.contextPopup = function(menuData) { // On contextmenu event (right click) this.bind('contextmenu', function(e) { + if ( settings.beforeOpen ) { + settings.beforeOpen(e); + } + var menu = createMenu(e) .show(); From 2f3cd6131235888078480a0a59911db182f99765 Mon Sep 17 00:00:00 2001 From: Michele Beltrame Date: Wed, 30 Oct 2013 17:45:30 +0100 Subject: [PATCH 2/2] Avoid links to follow href --- jquery.contextmenu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.contextmenu.js b/jquery.contextmenu.js index e511169..5a81885 100644 --- a/jquery.contextmenu.js +++ b/jquery.contextmenu.js @@ -57,7 +57,7 @@ jQuery.fn.contextPopup = function(menuData) { } row.find('span').text(item.label); if (item.action) { - row.find('a').click(function(){ item.action(e); }); + row.find('a').click(function(){ item.action(e); return false; }); } } else { $('
  • ').appendTo(menu);