If the window top position is about 100px from the bottom, I want to create a fading in/out effect for the element overlay
.
Any ideas on how to achieve this?
.section-card{
position: relative;
height: 500px;
line-height: 500px;
text-align: center;
font-size: 46px;
color: #fff;
background: #777;
}
.section-card:nth-child(2) {
background: #666;
}
.section-card:nth-child(3) {
background: #555;
}
.section-card:nth-child(4) {
background: #444;
}
.section-card:nth-child(5) {
background: #333;
}
.overlay{
pointer-events: none;
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
visibility: hidden;
background-color: #000;
opacity: 0;
}
<div class="section-card">
1
<div class="overlay"></div>
</div>
<div class="section-card">
2
<div class="overlay"></div>
</div>
<div class="section-card">
3
<div class="overlay"></div>
</div>
<div class="section-card">
4
<div class="overlay"></div>
</div>
<div class="section-card">
5
<div class="overlay"></div>
</div>