Skip to content

Commit 331c527

Browse files
authored
Pre-Show callback to display native menu
Quick implementation for swisnl#669 - adds a preShow - callback to the events. When the callback returns false, browsers native menu is shown.
1 parent 16e4b14 commit 331c527

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/jquery.contextMenu.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@
239239
},
240240
// events
241241
events: {
242+
preShow: $.noop,
242243
show: $.noop,
243244
hide: $.noop,
244245
activated: $.noop
@@ -278,6 +279,11 @@
278279
// contextmenu show dispatcher
279280
contextmenu: function (e) {
280281
var $this = $(this);
282+
283+
//Show browser context-menu when preShow returns false
284+
if (e.data.events.preShow($this,e) === false) {
285+
return;
286+
}
281287

282288
// disable actual context-menu if we are using the right mouse button as the trigger
283289
if (e.data.trigger === 'right') {

0 commit comments

Comments
 (0)