document.addEventListener('DOMContentLoaded', function() { var svgPaths = document.querySelectorAll('.svg-icon path'); var windowHeight = window.innerHeight; function handleScroll() { var scrollPosition = window.scrollY || window.pageYOffset; var scrollPercentage = scrollPosition / (document.documentElement.scrollHeight - windowHeight); var fillValue = Math.min(scrollPercentage * 2, 1); // Adjust the multiplier as needed svgPaths.forEach(function(path) { path.style.fill = 'rgba(255, 0, 0, ' + fillValue + ')'; }); } window.addEventListener('scroll', handleScroll); });