From 729ed6f6a89fac055e3f94375b389ee0c37ca7a2 Mon Sep 17 00:00:00 2001 From: Marcin Kurczewski Date: Wed, 30 Jul 2014 08:53:38 +0200 Subject: [PATCH] Added setting optimal height to thumbnails --- public_html/media/js/post-list.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public_html/media/js/post-list.js b/public_html/media/js/post-list.js index dacdb80e..f2cb5b59 100644 --- a/public_html/media/js/post-list.js +++ b/public_html/media/js/post-list.js @@ -44,7 +44,10 @@ function alignPosts() var margin = thumbnailOuterWidth - thumbnailInnerWidth; var numberOfThumbnailsToFitInRow = Math.ceil(containerWidth / thumbnailOuterWidth); var newThumbnailWidth = Math.floor(containerWidth / numberOfThumbnailsToFitInRow) - margin; - container.find('.thumb').css('width', newThumbnailWidth + 'px'); + var newThumbnailHeight = newThumbnailWidth * thumbnailHeight / thumbnailWidth; + container.find('.thumb').css({ + width: newThumbnailWidth + 'px', + height: newThumbnailHeight + 'px'}); } $(function()