- backgroundPicture directive

This commit is contained in:
tmshv committed 2016-02-22 02:09:03 +03:00
1 parent 54dc25d017
commit cadee171fc
2 files changed
-27

No files matched your search

-1
View File
@@ -92,7 +92,6 @@ app.run(($location, $rootScope, $http) => {
api,
IOService,
MenuService,
require('./directives/backgroundPicture'),
require('./ui/breadcrumbs'),
require('./ui/timeline'),
require('./filters/strip'),
@@ -1,26 +0,0 @@
module.exports = function (app) {
app.directive('backgroundPicture', function () {
return {
restrict: 'E',
template: '<div class="background-picture" />',
scope: {
src: '='
},
link: function($scope, $element){
var element = $element.find('.background-picture').get(0);
element.style.backgroundImage = `url('${$scope.src}')`;
setTimeout(function () {
var w = element.offsetWidth;
var h = element.offsetHeight;
if (w > h) {
element.classList.add('horizontal');
} else {
element.classList.add('vertical');
}
}, 100);
}
}
});
};