From fe85b1295abcb3eed3cff5b6a5961207c1887b7f Mon Sep 17 00:00:00 2001 From: Euge Gimelberg Date: Thu, 6 Dec 2012 20:33:30 -0800 Subject: [PATCH 1/2] Prevent the context menu from instantly being hidden when using ctrl-click to trigger it. --- bootstrap-contextmenu.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bootstrap-contextmenu.js b/bootstrap-contextmenu.js index cf5650b7..54ff3a87 100644 --- a/bootstrap-contextmenu.js +++ b/bootstrap-contextmenu.js @@ -38,7 +38,9 @@ var $el = $(element).on('contextmenu.context.data-api', this.toggle); var $target = $($el.attr('data-target')); $('html').on('click.context.data-api', function () { + if (!e.ctrlKey) { $target.removeClass('open'); + } }); } @@ -119,9 +121,12 @@ return $.extend(tp, Y, X); } - function clearMenus() { - getMenu($(toggle)) - .removeClass('open'); + function clearMenus(e) { + if (!e.ctrlKey) { + getMenu($(toggle)) + .removeClass('open'); + } + } /* CONTEXT MENU PLUGIN DEFINITION From 6b2dda954ac57fb775ff70555dd612c8f61b0df0 Mon Sep 17 00:00:00 2001 From: sydcanem Date: Sun, 16 Dec 2012 09:29:50 +0800 Subject: [PATCH 2/2] Update bootstrap-contextmenu.js e not declared on line 40, --- bootstrap-contextmenu.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bootstrap-contextmenu.js b/bootstrap-contextmenu.js index 54ff3a87..a62953cc 100644 --- a/bootstrap-contextmenu.js +++ b/bootstrap-contextmenu.js @@ -37,7 +37,7 @@ , ContextMenu = function (element) { var $el = $(element).on('contextmenu.context.data-api', this.toggle); var $target = $($el.attr('data-target')); - $('html').on('click.context.data-api', function () { + $('html').on('click.context.data-api', function (e) { if (!e.ctrlKey) { $target.removeClass('open'); } @@ -153,4 +153,4 @@ .on('contextmenu.context.data-api', toggle, ContextMenu.prototype.toggle); }); -}(window.jQuery)); \ No newline at end of file +}(window.jQuery));