mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-24 11:15:24 +01:00
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
(function() {
|
|
|
|
'use strict';
|
|
|
|
angular
|
|
.module('harbor.layout.element.height')
|
|
.directive('elementHeight', elementHeight);
|
|
|
|
function elementHeight($window) {
|
|
var directive = {
|
|
'restrict': 'A',
|
|
'link': link
|
|
};
|
|
|
|
return directive;
|
|
|
|
function link(scope, element, attrs) {
|
|
|
|
var w = angular.element($window);
|
|
|
|
scope.getDimension = function() {
|
|
return {'h' : w.height()};
|
|
};
|
|
|
|
if(!angular.isDefined(scope.subsHeight)) scope.subsHeight = 110;
|
|
if(!angular.isDefined(scope.subsSection)) scope.subsSection = 32;
|
|
if(!angular.isDefined(scope.subsSubPane)) scope.subsSubPane = 226;
|
|
|
|
scope.$watch(scope.getDimension, function(current) {
|
|
if(current) {
|
|
var h = current.h;
|
|
element.find('.section').css({'height': (h - scope.subsHeight - scope.subsSection) + 'px'});
|
|
element.find('.sub-pane').css({'height': (h - scope.subsHeight - scope.subsSubPane) + 'px'});
|
|
element.find('.tab-pane').css({'height': (h - scope.subsHeight - scope.subsSubPane) + 'px'});
|
|
}
|
|
}, true);
|
|
|
|
w.on('pageshow, resize', function() {
|
|
scope.$apply();
|
|
});
|
|
}
|
|
}
|
|
|
|
})(); |