Created
December 8, 2018 10:26
-
-
Save comphonia/17799a617af71286ac1ce3c78790d996 to your computer and use it in GitHub Desktop.
simple preloader
This file contains hidden or 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
//HTML, include as 1st in body tag | |
<div class="loader"> | |
<div class="spinner"> | |
</div> | |
</div> | |
//CSS | |
.loader{ | |
width: 100%; | |
height: 100%; | |
background-color: #fff; | |
position: fixed; | |
top: 0; | |
left: 0; | |
z-index: 1000; | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
} | |
.spinner { | |
border: 16px solid #f3f3f3; | |
border-radius: 50%; | |
border-top: 16px solid #3498db; | |
width: 100px; | |
height: 100px; | |
-webkit-animation: spin 2s linear infinite; /* Safari */ | |
animation: spin 2s linear infinite; | |
} | |
/* Safari */ | |
@-webkit-keyframes spin { | |
0% { -webkit-transform: rotate(0deg); } | |
100% { -webkit-transform: rotate(360deg); } | |
} | |
@keyframes spin { | |
0% { transform: rotate(0deg); } | |
100% { transform: rotate(360deg); } | |
} | |
//JS | |
$(window).on('load',function(){ | |
$('.loader').delay(1000).fadeOut(1000); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment