I am trying to get the solutionBlock
elements to fade in one after another in sequence. I am using the duration
function to do so, but my attempt is not fairing very well.
There are three images in the snippet below. The first one isn't showing because of the next
function.
What am I doing wrong?
$('.solutionBlock').each(function(index) {
$(this).delay(500*index).next().addClass('active');
});
.solutionBlock {
width: 25%;
height: 40vh;
display: inline-block;
vertical-align: top;
overflow: hidden;
box-sizing: border-box;
border-bottom: 2px solid #FFF;
border-right: 2px solid #FFF;
position: relative;
cursor: pointer;
opacity: 0;
}
.solutionBlock.active {
opacity: 1;
-webkit-transition: all .35s ease;transition: all .35s ease;
}
.solutionBlock .overlay {
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.3);
z-index: 1;
-webkit-transition: all .35s ease;transition: all .35s ease;
top: 0;
left: 0;
right: 0;
position: absolute;
}
.solutionBlock:hover .overlay {
background-color: rgba(0,0,0,0.0);
-webkit-transition: all .35s ease;transition: all .35s ease;
}
.solutionBlock:hover img {
-webkit-transform: scale(1.1);transform: scale(1.1);
-webkit-transition: all .35s ease;transition: all .35s ease;
}
.solutionBlock img {
width: 100%;
height: 100%;
object-fit: cover;
-webkit-transition: all .35s ease;transition: all .35s ease;
}
.sBlockTitle {
font-size: 1.4rem;
font-family: 'Muli', sans-serif;
line-height: 1.4em;
color: #FFF;
padding: 0 20px;
font-weight: 800;
text-shadow: 2px 2px #242424;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<section id="solBlocks">
<div class="solutionBlock">
<div class="overlay"></div>
<img src="http://via.placeholder.com/300" alt="A">
<div class="total-center front">
<h2 class="sBlockTitle">A</h2>
</div>
</div><div class="solutionBlock">
<div class="overlay"></div>
<img src="http://via.placeholder.com/300" alt="B">
<div class="total-center front">
<h2 class="sBlockTitle">B</h2>
</div>
</div><div class="solutionBlock">
<div class="overlay"></div>
<img src="http://via.placeholder.com/300" alt="C">
<div class="total-center front">
<h2 class="sBlockTitle">C</h2>
</div>
</div>
</section>