Skip to content

Commit

Permalink
Vertically realign thumbnails after rotation so that they stay
Browse files Browse the repository at this point in the history
centered.  Partial fix for #1354.
  • Loading branch information
bharat committed Sep 10, 2010
1 parent 32878eb commit 6211ed6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/gallery.common.js
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions themes/wind/js/ui.init.js
Expand Up @@ -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
Expand Down

0 comments on commit 6211ed6

Please sign in to comment.