Created
November 14, 2016 12:58
-
-
Save 5iDS/086e04d6350666ef3603d85f1affd84a to your computer and use it in GitHub Desktop.
Directive for Preloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Define UI Elements | |
* ------------------------------------------------*/ | |
Application.Directives.uiPreloader = function () { | |
return { | |
restrict: 'AE', | |
scope: {}, | |
transclude: true, | |
template: '<div data-ng-transclude></div>', | |
link: function( scope, element, attrs ) { | |
//console.log('Cheif', element[0]); | |
function fadeout() { | |
console.info('Fading out...', element[0]); | |
var anti_fousc = element[0].style; | |
anti_fousc.opacity = 1; | |
(function fade(){ | |
(anti_fousc.opacity-=.1)<0.2?_openUp():setTimeout(fade,20); | |
})(); | |
}; | |
function _openUp() { | |
var anti_fousc = element[0].style; | |
anti_fousc.display="none"; | |
window.sr = new scrollReveal( srDefaults ); | |
} | |
domReady( function () { | |
fadeout(); | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment