diff --git a/modules/albums/client/controllers/albums.client.controller.js b/modules/albums/client/controllers/albums.client.controller.js index ecb4ac20..24578bdf 100644 --- a/modules/albums/client/controllers/albums.client.controller.js +++ b/modules/albums/client/controllers/albums.client.controller.js @@ -14,15 +14,26 @@ vm.torrentTypeConfig = MeanTorrentConfig.meanTorrentConfig.torrentType; vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig; - /** - * $scope.$watch($('#nav-top-menu').width()) + * $scope.$watch($('.albums-item').width()) */ $scope.$watch(function () { return $('.albums-item').width(); }, function (newVal, oldVal) { if (newVal) { - $('.albums-item').height($('.albums-item').width() / 1.772); + var elements = $('.albums-item img'); + + angular.forEach(elements, function(e){ + var element = angular.element(e); + + element.parent().height(element.parent().width() / 1.772); + + if (element.height() > element.parent().height()) { + element.css('margin-top', -(element.height() - element.parent().height()) / 2); + } else { + element.css('margin-top', (element.parent().height() - element.height()) / 2); + } + }); } }); diff --git a/modules/collections/client/controllers/collections.client.controller.js b/modules/collections/client/controllers/collections.client.controller.js index 43ca2f8f..9698d487 100644 --- a/modules/collections/client/controllers/collections.client.controller.js +++ b/modules/collections/client/controllers/collections.client.controller.js @@ -17,13 +17,25 @@ vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig; /** - * $scope.$watch($('#nav-top-menu').width()) + * $scope.$watch($('collection-item').width()) */ $scope.$watch(function () { - return $('.albums-item').width(); + return $('.collection-item').width(); }, function (newVal, oldVal) { if (newVal) { - $('.albums-item').height($('.albums-item').width() / 1.772); + var elements = $('.collection-item img'); + + angular.forEach(elements, function(e){ + var element = angular.element(e); + + element.parent().height(element.parent().width() / 1.772); + + if (element.height() > element.parent().height()) { + element.css('margin-top', -(element.height() - element.parent().height()) / 2); + } else { + element.css('margin-top', (element.parent().height() - element.height()) / 2); + } + }); } }); diff --git a/modules/core/client/controllers/home.client.controller.js b/modules/core/client/controllers/home.client.controller.js index 28e6e878..a0eb7167 100644 --- a/modules/core/client/controllers/home.client.controller.js +++ b/modules/core/client/controllers/home.client.controller.js @@ -70,13 +70,25 @@ }; /** - * $scope.$watch($('#nav-top-menu').width()) + * $scope.$watch($('.albums-item').width()) */ $scope.$watch(function () { return $('.albums-item').width(); }, function (newVal, oldVal) { if (newVal) { - $('.albums-item').height($('.albums-item').width() / 1.772); + var elements = $('.albums-item img'); + + angular.forEach(elements, function(e){ + var element = angular.element(e); + + element.parent().height(element.parent().width() / 1.772); + + if (element.height() > element.parent().height()) { + element.css('margin-top', -(element.height() - element.parent().height()) / 2); + } else { + element.css('margin-top', (element.parent().height() - element.height()) / 2); + } + }); } });