I'm currently browsing Cnet's website and I am intrigued by their sliding layer effect on the homepage. Take a look at their homepage
https://i.sstatic.net/7IcHn.jpg
I am trying to figure out how they achieved this effect. It seems like it involves positioning one layer fixed in the middle with a combination of z-index and a significant margin-top between layers, but I can't quite crack the code.
Any insights or suggestions?
#blue, #green, #red {
height: 500px;
width: 100%;
}
#blue {
background: blue;
z-index: 1;
}
#green {
background: green;
position: fixed;
margin-top: 200px;
}
#red {
background: red;
z-index: 1;
margin-top: 500px;
}
<div id="blue"></div>
<div id="green"></div>
<div id="red"></div>