Last active
May 1, 2018 09:37
-
-
Save ThomasLarge/d9951969353eab28929ca32b5c79222e to your computer and use it in GitHub Desktop.
Preloader with Gsap
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
<!-- Preloader --> | |
<div id="preloader"> | |
<div id="status"> </div> | |
</div> |
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
jQuery(window).on('load', function() { // makes sure the whole site is loaded | |
jQuery('#status').fadeOut(); // will first fade out the loading animation | |
jQuery('#preloader').delay(350).fadeOut('slow'); // will fade out the white DIV that covers the website. | |
jQuery('body').delay(350).css({'overflow':'visible'}); | |
}) |
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
/* Preloader */ | |
#preloader { | |
position:fixed; | |
top:0; | |
left:0; | |
right:0; | |
bottom:0; | |
background-color: #26333e; /* change if the mask should have another color then white */ | |
z-index:9999; /* makes sure it stays on top */ | |
} | |
#status { | |
width:200px; | |
height:200px; | |
position:absolute; | |
left:50%; /* centers the loading animation horizontally one the screen */ | |
top:50%; /* centers the loading animation vertically one the screen */ | |
background-image:url(../img/status.gif); /* path to your loading animation */ | |
background-repeat:no-repeat; | |
background-position:center; | |
margin:-100px 0 0 -100px; /* is width and height divided by two */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment