snippets star schaufler.ch

Parallax Background

function parallax() {
  window.onscroll = function() {
    var speed = 5.0;
    document.body.style.backgroundPosition = (-window.pageXOffset/speed)+"px "+(-window.pageYOffset/speed)+"px";
  }
}
Tags: javascript, scroll von Andy 12-07-2016