diff --git a/js/galleryalbum.js b/js/galleryalbum.js index 05a50815b..0d8afcd01 100644 --- a/js/galleryalbum.js +++ b/js/galleryalbum.js @@ -48,6 +48,7 @@ this.domDef = null; this.loader = null; this.preloadOffset = 0; + this.defaultRatio = 1; }; Album.prototype = { @@ -171,7 +172,7 @@ if (more && album.viewedItems < images.length) { return addRowElements(album, row, images); } - row.fit(); + album.defaultRatio = row.fit(album.defaultRatio); def.resolve(row); }); }; diff --git a/js/galleryrow.js b/js/galleryrow.js index 12467ac2e..e51502f47 100644 --- a/js/galleryrow.js +++ b/js/galleryrow.js @@ -123,8 +123,8 @@ /** * Resizes the row once it's full */ - fit: function () { - var scaleRatio = (this.width > this.targetWidth) ? this.targetWidth / this.width : 1; + fit: function (defaultRatio) { + var scaleRatio = (this.width > this.targetWidth) ? this.targetWidth / this.width: defaultRatio; // This animates the elements when the window is resized var targetHeight = 4 + (this.targetHeight * scaleRatio); @@ -149,6 +149,8 @@ // Restore the rows to their normal opacity. This happens immediately with rows // containing albums only this.domDef.css('opacity', 1); + + return scaleRatio; }, /**