JSFiddle - React, Tailwind, and code Playground
CSS
body {
background-image: url('http://placehold.it/350x250&text=background-1');
background-repeat:no-repeat;
background-attachment:fixed;
background-size:cover;
height:3000px;
}
JavaScript
var a = 'http://placehold.it/350x250&text=background-1',
b = 'http://placehold.it/350x250&text=background-2';
var newImg = new Image();
newImg.src = b;
$(window).scroll(function () {
if ($(this).scrollTop() > 800) {
$('body').css({backgroundImage: 'url("'+b+'")'});
}else{
$('body').css({backgroundImage:'url("'+a+'")'});
}
});