laipower/wp-content/upgrade-temp-backup/plugins/gp-premium/elements/assets/js/parallax.min.js

2 lines
405 B
JavaScript
Raw Normal View History

2023-10-22 22:21:44 +00:00
function generate_parallax_element(e,o){var t=(o=o||document).querySelectorAll(e);return Array.prototype.slice.call(t)}window.addEventListener("scroll",function(){var r=window.pageYOffset;generate_parallax_element(".page-hero").forEach(function(e,o,t){var a=e.offsetTop+e.offsetHeight;r>e.offsetTop&&r<=a?e.style.backgroundPositionY=(r-e.offsetTop)/hero.parallax+"px":e.style.backgroundPositionY="0"})});