diff --git a/lib/gallery.js b/lib/gallery.js index 9a1772f..ffbe5c3 100644 --- a/lib/gallery.js +++ b/lib/gallery.js @@ -203,7 +203,7 @@ Gallery = (function(superClass) { }; Gallery.prototype._renderImage = function() { - var $win, fitSize, originSize, showZoom, stageSize, thumbImg; + var $win, originSize, showZoom, stageSize, thumbImg; if (!this.gallery) { return; } @@ -215,8 +215,7 @@ Gallery = (function(superClass) { height: $win.height() - 90 }; showZoom = this.curOriginSize.width > stageSize.width || this.curOriginSize.height > stageSize.height; - fitSize = this._fitSize(stageSize, this.curOriginSize); - this.gallery.css(fitSize); + this.gallery.css(this._fitSize(stageSize, this.curOriginSize)); this.img.attr('src', thumbImg.src); if (showZoom) { this.zoom_in = this.wrapper.find('.zoom-in'); diff --git a/src/gallery.coffee b/src/gallery.coffee index b58e307..231065c 100644 --- a/src/gallery.coffee +++ b/src/gallery.coffee @@ -191,9 +191,7 @@ class Gallery extends SimpleModule height: $win.height() - 90 showZoom = @curOriginSize.width > stageSize.width or @curOriginSize.height > stageSize.height - fitSize = @_fitSize stageSize, @curOriginSize - - @gallery.css fitSize + @gallery.css @_fitSize stageSize, @curOriginSize @img.attr('src', thumbImg.src) if showZoom