I'm trying to make a footer that will stay behind / hide when i will scroll up.
Imagine 2 div (first and second), one under the other :
<div id="first">
<div class="footer" style="color:red">
</div>
</div>
<div id="second">
<div class="footer" style="color:green">
</div>
</div>
The two footers are in fixed position, bottom 0, and #first and #second are in relative position. When i scroll down, the first footer disapear behind the #second. But when i scroll up, the #second footer doesn't disapear behind the #first div.
Illustration : Screen capture of my problem.
I need the green one to be hidden by the #first div (like the red one by the #second div).
body{
margin : 0px;
}
.parent{
height : 500px;
width : 100%;
position:relative;
}
.footer{
position:fixed;
bottom:0px;
left:0px;
}
<div class="parent" style="background-color:red;">
<div class="footer" style='color:yellow'>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
</div>
</div>
<div class="parent" style="background-color:green;">
<div class="footer" style='color:blue'>
<span>1</span>
<span>2</span>
<span>3</span>
</div>
</div>