Skip to content

Commit ea61704

Browse files
committed
Merge pull request #64 from toXXIc/gh-pages
Fixing timing problem with animation and remove on hide
2 parents 5c95d27 + e62cdfe commit ea61704

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/jquery.contextMenu.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -890,28 +890,28 @@ var // currently active contextMenu trigger
890890
//$(document).off('.contextMenuAutoHide keydown.contextMenu'); // http://bugs.jquery.com/ticket/10705
891891
$(document).off('.contextMenuAutoHide').off('keydown.contextMenu');
892892
// hide menu
893-
opt.$menu && opt.$menu[opt.animation.hide](opt.animation.duration);
894-
895-
// tear down dynamically built menu
896-
if (opt.build) {
897-
opt.$menu.remove();
898-
$.each(opt, function(key, value) {
899-
switch (key) {
900-
case 'ns':
901-
case 'selector':
902-
case 'build':
903-
case 'trigger':
904-
return true;
893+
opt.$menu && opt.$menu[opt.animation.hide](opt.animation.duration, function (){
894+
// tear down dynamically built menu after animation is completed.
895+
if (opt.build) {
896+
opt.$menu.remove();
897+
$.each(opt, function(key, value) {
898+
switch (key) {
899+
case 'ns':
900+
case 'selector':
901+
case 'build':
902+
case 'trigger':
903+
return true;
905904

906-
default:
907-
opt[key] = undefined;
908-
try {
909-
delete opt[key];
910-
} catch (e) {}
911-
return true;
912-
}
913-
});
914-
}
905+
default:
906+
opt[key] = undefined;
907+
try {
908+
delete opt[key];
909+
} catch (e) {}
910+
return true;
911+
}
912+
});
913+
}
914+
});
915915
},
916916
create: function(opt, root) {
917917
if (root === undefined) {

0 commit comments

Comments
 (0)