Skip to content

Instantly share code, notes, and snippets.

@5iDS
Created November 14, 2016 12:58
Show Gist options
  • Save 5iDS/086e04d6350666ef3603d85f1affd84a to your computer and use it in GitHub Desktop.
Save 5iDS/086e04d6350666ef3603d85f1affd84a to your computer and use it in GitHub Desktop.
Directive for Preloader
/*
* 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