Skip to content

Commit

Permalink
Fix two bugs with the context menu:
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bharat committed Sep 11, 2010
1 parent b35886c commit 8132764
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/gallery.common.js
Expand Up @@ -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);
}
};

Expand Down

0 comments on commit 8132764

Please sign in to comment.