summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-11 00:27:47 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-11 00:27:47 -0700
commit81327641cd4d2d5bf5e1de8438ebf44d0c318314 (patch)
tree53e2e875a542a0f128318f12144cc39f72183132
parentb35886c0fc6f2d37ee1974a35b0cad50e6729757 (diff)
Fix two bugs with the context menu:
1) Prevent it from "bouncing" which happens when we queue up a lot of open and close events. Stop any running animations before starting new ones. This fixes #1340. 2) Prevent a bug that's not really visible to the user where we wind up re-initializing a context menu over and over which results in us binding tons of hover events. I don't think this causes any serious damage, but it's probably not good.
-rw-r--r--lib/gallery.common.js15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/gallery.common.js b/lib/gallery.common.js
index 81e26e1b..2dbd7c7c 100644
--- a/lib/gallery.common.js
+++ b/lib/gallery.common.js
@@ -132,22 +132,23 @@
$.fn.gallery_context_menu = function() {
if ($(".g-context-menu li").length) {
var hover_target = $(this).find(".g-context-menu");
+ if (hover_target.attr("context_menu_initialized")) {
+ return;
+ }
var list = $(hover_target).find("ul");
- var in_progress = 0;
hover_target.find("*").removeAttr('title');
list.hide();
hover_target.hover(
function() {
- if (in_progress == 0) {
- list.slideDown("fast", function() { in_progress = 1; });
- $(this).find(".g-dialog-link").gallery_dialog();
- $(this).find(".g-ajax-link").gallery_ajax();
- }
+ list.stop(true, true).slideDown("fast");
+ $(this).find(".g-dialog-link").gallery_dialog();
+ $(this).find(".g-ajax-link").gallery_ajax();
},
function() {
- list.slideUp("slow", function() { in_progress = 0; });
+ list.stop(true, true).slideUp("slow");
}
);
+ hover_target.attr("context_menu_initialized", 1);
}
};