JSFiddle - React, Tailwind, and code Playground
by CSS_Apprentice
HTML
<div class="container">
<div class="square yellow"></div>
<div class="square red"></div>
<div class="square blue"></div>
<div class="square yellow"></div>
<div class="square red"></div>
<div class="square blue"></div>
<div class="square yellow"></div>
<div class="square red"></div>
<div class="square blue"></div>
</div>
CSS
.container {
width: 250px;
display: block;
margin: 0 auto;
}
/* jQuery related */
.hidden{
opacity:0;
}
.visible{
opacity:1;
}
/* Animate */
.animated {
-webkit-animation-duration: 1.25s;
animation-duration: 1.25s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
@-webkit-keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
@keyframes fadeIn {
0% {opacity: 0;}
100% {opacity: 1;}
}
.fadeIn {
-webkit-animation-name: fadeIn;
animation-name: fadeIn;
}
/* Boxes */
.square {
height: 100px;
width: 100px;
margin: 5% auto;
display: block;
}
.yellow {
background-color: yellow;
}
.red {
background-color: red;
}
.blue {
background-color: blue;
}
JavaScript
jQuery(document).ready(function() {
jQuery('.square').addClass("hidden").viewportChecker({
classToAdd: 'visible animated fadeIn',
offset: 100
});
});