personal-site/scripts/v2.js

19 lines
431 B
JavaScript
Raw Normal View History

2021-06-04 06:56:31 +00:00
const translate = document.querySelectorAll(".translate");
var watermark = document.querySelector(".hero-watermark");
var skewedBg = document.querySelector(".skewed-bg");
window.addEventListener("scroll", () => {
var scroll = window.pageYOffset;
translate.forEach(element => {
let speed = element.dataset.speed;
element.style.transform = "translateY(" + (scroll * speed) + "px)";
});
});