Sempervivum
Erfahrenes Mitglied
So funktioniert es bei mir:
Code:
<script>
(function () {
var parallax = document.querySelectorAll("body"),
speed = -0.8,
vmain = document.querySelector('main');
vmain.onscroll = function () {
[].slice.call(parallax).forEach(function (el, i) {
var elBackgrounPos = "50% " + (vmain.scrollTop * speed) + "px";
el.style.backgroundPosition = elBackgrounPos;
});
};
})();
</script>