I have some HTML set up like this:
<div class="mediasection large">
<div class="cover" style="background-image: url(/media/images/panorama.jpg);"></div>
<div class="overlay">Welcome!</div>
</div>
The cover element is uses background-attachment: fixed;
to create a parallax effect. What I'm trying to achieve is have the overlay element behave the same way, where the text in it is fixed to the viewport, but still contained inside the mediasection div, so that when the user scrolls the page the cover and overlay stay in the same position, but disappear as the mediasection element goes out of view.
Is there any way to achieve this?
tl;dr; Some sort of background-attachment: fixed;
to regular elements, not just the background.
Thanks!