/* * Parallax effect implementation * This file is part of the project's JavaScript code */ // Define the parallax effect function parallax() { const elements = document.querySelectorAll('.parallax'); elements.forEach((element, index) => { const speed = 0.2; const scrollPosition = window.scrollY; // Calculate the parallax offset const offset = scrollPosition * speed; // Update the element's style element.style.transform = `translate3d(-${offset}px, 0, 0)`; }); } // Add event listener for scrolling window.addEventListener('scroll', parallax);