laipower/wp-content/plugins/gp-premium/page-header/functions/js/parallax.min.js

1 line
435 B
JavaScript
Raw Normal View History

2020-04-07 13:03:04 +00:00
function generate_parallax_element(e,t){var a=(t=t||document).querySelectorAll(e);return Array.prototype.slice.call(a)}window.addEventListener("scroll",function(){var e=window.pageYOffset;generate_parallax_element(".parallax-enabled").forEach(function(t,a,o){var r=t.offsetTop+t.offsetHeight;e>t.offsetTop&&e<=r?t.style.backgroundPositionY=(e-t.offsetTop)/t.getAttribute("data-parallax-speed")+"px":t.style.backgroundPositionY="0"})});