Skip to content

Commit 25668c2

Browse files
committed
adding class context-menu-active to define state on active trigger element - Issue swisnl#92
1 parent 799fb77 commit 25668c2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ $.contextMenu is published under the [MIT license](http://www.opensource.org/lic
111111
* fixing menu and submenu width calculation - ([Issue 18](https://github.com/medialize/jQuery-contextMenu/issues/18))
112112
* fixing unused variables - ([Issue 100](https://github.com/medialize/jQuery-contextMenu/issues/100))
113113
* adding export of internal functions and event handlers - ([Issue 101](https://github.com/medialize/jQuery-contextMenu/issues/101))
114+
* adding class `context-menu-active` to define state on active trigger element - ([Issue 92](https://github.com/medialize/jQuery-contextMenu/issues/92))
114115

115116

116117
### 1.5.25 ###

src/jquery.contextMenu.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,8 +817,11 @@ var // currently active contextMenu trigger
817817

818818
// position and show context menu
819819
opt.$menu.css( css )[opt.animation.show](opt.animation.duration);
820-
// make options available
821-
$trigger.data('contextMenu', opt);
820+
// make options available and set state
821+
$trigger
822+
.data('contextMenu', opt)
823+
.addClass("context-menu-active");
824+
822825
// register key handler
823826
$(document).off('keydown.contextMenu').on('keydown.contextMenu', handle.key);
824827
// register autoHide handler
@@ -847,6 +850,11 @@ var // currently active contextMenu trigger
847850
return;
848851
}
849852

853+
// remove options and revert state
854+
$trigger
855+
.removeData('contextMenu')
856+
.removeClass("context-menu-active");
857+
850858
if (opt.$layer) {
851859
// keep layer for a bit so the contextmenu event can be aborted properly by opera
852860
setTimeout((function($layer) {

0 commit comments

Comments
 (0)