using class “.gomo-parallax” and a GSAP function
gsap.registerPlugin(ScrollTrigger);
function initGomoParallax() {
gsap.utils.toArray(".gomo-parallax").forEach(function (coverParallax) {
var imageParallax = document.getElementsByClassName(
"wp-block-cover__image-background"
);
gsap
.timeline({
scrollTrigger: {
trigger: coverParallax,
scrub: true,
start: "top bottom",
end: "bottom top",
markers: true,
},
})
.fromTo(
imageParallax,
{
y: -100,
scale: 1.5,
},
{ y: 100, scale: 1.5, ease: "none" },
0
);
});
}
window.addEventListener("load", function () {
initGomoParallax();
});