Skip to content

Instantly share code, notes, and snippets.

@LinguistMB
Created February 5, 2018 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LinguistMB/551db66e1b57a8f47cb2311c0ef144b3 to your computer and use it in GitHub Desktop.
Save LinguistMB/551db66e1b57a8f47cb2311c0ef144b3 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
window.onload = function() {
function fadeOut(el){
el.style.opacity = 1;
var last;
var tick = function() {
el.style.opacity = +el.style.opacity - (new Date() - last) / 600;
last = +new Date();
if (+el.style.opacity > 0) {
(window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 100);
} else{
el.style.display = "none";
}
};
tick();
}
var pagePreloaderId = document.getElementById("page-preloader");
setTimeout(
function () {
fadeOut(pagePreloaderId)
}, 1000);
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment