I tried to get the "background image change on scroll" working on my page. but while scrolling the changes are flickering. I couldn't find a solution in other threads.
This is what I have:
jquery:
$(function(){
$(document).scroll(function () {
if ($(this).scrollTop() > 1) {
$('body').css({
backgroundImage: 'url("img/picture1.jpg")'
});
}
if ($(this).scrollTop() > 800) {
$('body').css({
backgroundImage: 'url("img/picture2.jpg")'
});
}
CSS:
body {
background: url('../img/picture1.jpg');
background-repeat:no-repeat;
background-attachment:fixed;
background-size:cover;
}