JSFiddle - React, Tailwind, and code Playground
by Pamela Cook
HTML
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<div id="preloader">
<div id="status">Loading....</div>
</div>
<header style="background-color: #000000; height: 25%; width: 100%; text-align: center; color: #ffffff">
This is a test header to see if I can get it to display after the preloader
</header>
<body style="background-color: #ff0000; height: 75%; width: 100%; text-align: center; color: #ffffff">
This is the body of the page I want to display after the preloader does
</body>
SCSS
/* Preloader */
#preloader {
display: table;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #000000;
z-index: 99999;
text-align: center;
background: url("https://s3.amazonaws.com/nbcbigbend/church-preloader.jpg") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-ms-background-size: cover;
background-size: cover;
}
#preloader #status {
display: table-cell;
vertical-align: middle;
img {
width: 10%;
height: auto;
}
opacity: 1;
font-family: Arial;
font-size: 700%;
color: #ffffff;
-webkit-animation: fadeoutpulse .25s infinite;
-moz-animation: fadeoutpulse .25s infinite;
-ms-animation: fadeoutpulse .25s infinite;
animation: fadeoutpulse .25s infinite;
}
@-webkit-keyframes fadeoutpulse {
100% {
opacity: 0;
}
0% {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.05, 1.05, 1.05);
}
100% {
transform: scale3d(1, 1, 1);
}
}
@-moz-keyframes fadeoutpulse {
100% {
opacity: 0;
}
0% {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.05, 1.05, 1.05);
}
100% {
transform: scale3d(1, 1, 1);
}
}
@-ms-keyframes fadeoutpulse {
100% {
opacity: 0;
}
0% {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.05, 1.05, 1.05);
}
100% {
transform: scale3d(1, 1, 1);
}
}
@keyframes fadeoutpulse {
100% {
opacity: 0;
}
0% {
transform: scale3d(1, 1, 1);
}
50% {
transform: scale3d(1.05, 1.05, 1.05);
}
100% {
transform: scale3d(1, 1, 1);
}
}
JavaScript
// Preloader */
$(window).load(function() {
// will first fade out the loading animation
$("#status").fadeOut("slow");
// will fade out the whole DIV that covers the website.
$("#preloader").delay(5000).fadeOut("slow").remove();
})