const parallax = document.getElementById("home-img-lg"); const parallax1 = document.getElementById("parallax1"); const parallax2 = document.getElementById("parallax2"); window.addEventListener("scroll", function() { let offset = window.pageYOffset; parallax.style.backgroundPositionX = offset*(-0.7)-500 + "px"; }) window.addEventListener("scroll", function() { let offset = window.pageYOffset; offset-=3100; if(window.innerWidth > 1000){ parallax1.style.backgroundPositionY = offset*(0.1) -150+ "px"; }else{ parallax1.style.backgroundPositionY = 'initial'; } }) window.addEventListener("scroll", function() { let offset = window.pageYOffset; offset-=4800; parallax2.style.backgroundPositionY = offset*(-0.05) + "px"; }) function myFunction() { document.getElementById("check").checked = false; } function reveal() { var reveals = document.querySelectorAll(".reveal"); for (var i = 0; i < reveals.length; i++) { var windowHeight = window.innerHeight; var elementTop = reveals[i].getBoundingClientRect().top; var elementVisible = 150; if (elementTop < windowHeight - elementVisible) { reveals[i].classList.add("active"); } else { reveals[i].classList.remove("active"); } } } window.addEventListener("scroll", reveal);