Stackoverflow: Parallax problem?
by tcloninger
HTML
<div class="item">
<div class="caption">
<h1>Lorem Ipsum</h1>
</div>
</div>
CSS
.item{
background:url("http://placekitten.com/300/300");
background-attachment:fixed;
height:1000px;
width:100%;
position:relative;
}
.caption{
position:relative;
margin-top:200px;
}
JavaScript
$(window).scroll(function () {
$('.caption').css({
'top' : -($(this).scrollTop()/-2)+"px"
});
});