JSFiddle - React, Tailwind, and code Playground
HTML
<div id='loader'>
<div id='overlay'></div>
<div id='text'>
Text content goes in here
</div>
</div>
<div id='main'>Main Website Here</div>
CSS
#loader {
Display:block;
}
#overlay {
position: absolute;
top: 0;
height:250px;
left: 0;
right: 0;
border-left: 50px solid #000;
background-color: #FFF;
float:left;
}
#text {
font-size:24px;
font-weight:bold;
text-transform:uppercase;
font-family:helvetica;
float:left;
display:none;
}
#main {
display:none;
background:red;
height:200px;
}
JavaScript
$(window).load(function() {
$rec = $('#overlay');
$rec.animate({opacity:0}, {duration:50})
.animate({opacity:1}, {duration:50})
.animate({opacity:0}, {duration:50})
.animate({opacity:1}, {duration:50})
.animate({opacity:0}, {duration:50})
.animate({ opacity:1, duration:50 }, function() {
//animation complete
$('#text').show();
$('#overlay').delay(500).animate({
left:$(this).width()
}, 800, function() {
$('#overlay').delay(1000).animate({
//go back to the beginning
left:0
}, 1000, function() {
//rehide the text
$('#text').hide();
//flicker once rectangle goes back to beginning
$(this).animate({opacity:0}, {duration:50})
.animate({opacity:1}, {duration:50})
.animate({opacity:0}, {duration:50})
.animate({opacity:1}, {duration:50})
.animate({opacity:0}, {duration:50},function() {
//fade out after flicker
$(this).fadeOut('slow');
});
});
});
});
});