fix(albums): fixed albums size issue

This commit is contained in:
OldHawk
2018-05-25 04:15:51 +08:00
parent f24219abdd
commit 39213b85d5
3 changed files with 43 additions and 8 deletions

View File

@@ -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);
}
});
}
});

View File

@@ -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);
}
});
}
});

View File

@@ -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);
}
});
}
});