fix(collections): fixed collection item height issue

This commit is contained in:
OldHawk
2018-05-23 02:23:56 +08:00
parent ebafecd209
commit 4cba23dd48
2 changed files with 20 additions and 3 deletions

View File

@@ -6,16 +6,29 @@
.controller('CollectionController', CollectionController);
CollectionController.$inject = ['$scope', '$translate', 'getStorageLangService', 'MeanTorrentConfig', 'CollectionsService', 'NotifycationService',
'DebugConsoleService'];
'DebugConsoleService', '$timeout'];
function CollectionController($scope, $translate, getStorageLangService, MeanTorrentConfig, CollectionsService, NotifycationService,
mtDebug) {
mtDebug, $timeout) {
var vm = this;
vm.lang = getStorageLangService.getLang();
vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
vm.tmdbConfig = MeanTorrentConfig.meanTorrentConfig.tmdbConfig;
/**
* window.resize()
*/
$(window).resize(function () {
vm.setAlbumItemHeight();
});
/**
* setAlbumItemHeight
*/
vm.setAlbumItemHeight = function () {
$('.collection-item').height($('.collection-item').width() / 1.772);
};
/**
* buildPager
@@ -37,6 +50,10 @@
vm.filterLength = items.total;
vm.pagedItems = items.rows;
$timeout(function () {
vm.setAlbumItemHeight();
}, 10)
if (callback) callback();
});
};

View File

@@ -27,7 +27,7 @@
<div class="row">
<div class="collection-items">
<div ng-repeat="m in vm.pagedItems">
<div ng-repeat="m in vm.pagedItems" ng-if="m.torrents.length>0">
<div data-ng-if="$index != 0 && $index % 2 == 0" class="clearfix visible-sm-block"></div>
<div data-ng-if="$index != 0 && $index % 3 == 0" class="clearfix visible-md-block visible-lg-block"></div>
<div class="col-sm-6 col-md-4">