Вот довольно простое решение без каких-либо плагинов и jQuery. Работает на мобильном телефоне:
http://codepen.io/DreySkee/pen/6384ef57faaf278ed331c6c56e76fa0d
HTML:
<div id="fixed-bg"></div>
<div id="content">
<div class="section addPadding"></div>
<div class="section addPadding"></div>
<div class="section"></div>
</div>
CSS:
#fixed-bg {
position: fixed;
width: 100%;
background: url('http://juliewight.com/wp-content/uploads/2013/11/space-wallpaper-widescreen-2.jpg') no-repeat;
background-size: cover;
}
#content {
position: relative;
}
#content .section {
height: 500px;
width: 100%;
background: rgba(255,255,255, 0.8);
}
JS:
var fixedBg = document.getElementById('fixed-bg');
var section = document.getElementsByClassName('section');
var sectionGap = document.getElementsByClassName('addPadding');
var h = window.innerHeight;
fixedBg.style.height = h+"px";
for (var i = 0; i < section.length; i++) {
section[i].style.height = h+"px";
}
for (var i = 0; i < sectionGap.length; i++) {
sectionGap[i].style.marginBottom = h+"px";
}
Вы можете использовать [3D CSS параллакса] (HTTP: //blog.keithclark.co.uk/pure-css-parallax -websites /) для (большей) мобильной поддержки. – Blazemonger
Спасибо за быструю помощь @Blazemonger – Preeti