summaryrefslogtreecommitdiff
path: root/modules/gallery/js/quick.js
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-07-21 13:39:40 -0700
committerBharat Mediratta <bharat@menalto.com>2009-07-21 13:39:40 -0700
commit0546f0df13471664255a18b45c7464cc7f7f370e (patch)
tree16e0c4775641e3551336cecda046ce42c8067979 /modules/gallery/js/quick.js
parent80f48b084af874fea52ed29f06a1337954b137bf (diff)
Fix the bug that the quick menu fires for the wrong photo. This stems
from using a single gQuickPane <div> that we move around. A race condition happens when you mouse over two thumbnails quickly. Whichever server response loses the race gets displayed, and sometimes it's the one that you're no longer hovering over. Fix it by changing gQuickPane to be a class and creating a <div> per thumbnail. Fixes ticket #290.
Diffstat (limited to 'modules/gallery/js/quick.js')
-rw-r--r--modules/gallery/js/quick.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js
index 3ac97f8e..fda6470f 100644
--- a/modules/gallery/js/quick.js
+++ b/modules/gallery/js/quick.js
@@ -12,15 +12,15 @@ var show_quick = function() {
var cont = $(this);
var quick = $(this).find(".gQuick");
var img = cont.find(".gThumbnail,.gResize");
- $("#gQuickPane").remove();
- cont.append("<div id=\"gQuickPane\"></div>");
- $("#gQuickPane").hide();
- cont.hover(function() {}, hide_quick);
+ cont.find(".gQuickPane").remove();
+ cont.append("<div class=\"gQuickPane\"></div>");
+ cont.find(".gQuickPane").hide();
+ cont.hover(function() {}, function() { cont.find(".gQuickPane").remove(); });
$.get(
quick.attr("href"),
{},
function(data, textStatus) {
- $("#gQuickPane").html(data).slideDown("fast");
+ cont.find(".gQuickPane").html(data).slideDown("fast");
$(".ui-state-default").hover(
function() {
$(this).addClass("ui-state-hover");
@@ -29,13 +29,13 @@ var show_quick = function() {
$(this).removeClass("ui-state-hover");
}
);
- $("#gQuickPane a:not(.options)").click(function(e) {
+ cont.find(".gQuickPane a:not(.options)").click(function(e) {
e.preventDefault();
quick_do(cont, $(this), img);
});
- $("#gQuickPane a.options").click(function(e) {
+ cont.find(".gQuickPane a.options").click(function(e) {
e.preventDefault();
- $("#gQuickPaneOptions").slideToggle("fast");
+ cont.find(".gQuickPaneOptions").slideToggle("fast");
});
}
);
@@ -76,7 +76,3 @@ var quick_do = function(cont, pane, img) {
}
return false;
};
-
-var hide_quick = function() {
- $("#gQuickPane").remove();
-};