summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gallery.common.js8
-rw-r--r--themes/wind/js/ui.init.js5
2 files changed, 11 insertions, 2 deletions
diff --git a/lib/gallery.common.js b/lib/gallery.common.js
index 9fccc602..548b2e7c 100644
--- a/lib/gallery.common.js
+++ b/lib/gallery.common.js
@@ -24,8 +24,12 @@
if (container == null) {
container = 'div';
}
- $(this).html("<" + container + " class=\"g-valign\">" + $(this).html() + "</" + container + ">");
- var el = $(this).children(container + ".g-valign");
+ var el = $(this).find(".g-valign");
+ if (!el.length) {
+ $(this).html("<" + container + " class=\"g-valign\">" + $(this).html() +
+ "</" + container + ">");
+ el = $(this).children(container + ".g-valign");
+ }
var elh = $(el).height();
var ph = $(this).height();
var nh = (ph - elh) / 2;
diff --git a/themes/wind/js/ui.init.js b/themes/wind/js/ui.init.js
index a4fc0e2f..7637ad80 100644
--- a/themes/wind/js/ui.init.js
+++ b/themes/wind/js/ui.init.js
@@ -93,6 +93,11 @@ $(document).ready(function() {
$("#g-place-holder").remove();
}
);
+
+ // Realign any thumbnails that change so that when we rotate a thumb it stays centered.
+ $(".g-item").bind("gallery.change", function() {
+ $(this).gallery_valign();
+ });
}
// Photo/Item item view