Ah, noted on the Media Query events.
—
Regards to the .matchMedia(), are you saying I can do it like this:
ScrollTrigger.matchMedia({
"(min-width: 800px)": () => {
gsap.to(container, {
x: () => -(container.offsetWidth - document.documentElement.clientWidth) + "px",
ease: "none",
scrollTrigger: {
trigger: container,
pin: true,
scrub: true,
end: () => "+=" + container.offsetWidth
}
})
}
});
As this looks wrong to me, so my question is, do I need to re-code the opening posts setup to use .matchMedia(), without using scrollTrigger: {} within GSAP.
or the other question was, is there a property to use within the animation.
gsap.to(container, {
x: () => -(container.offsetWidth - document.documentElement.clientWidth) + "px",
ease: "none",
scrollTrigger: {
trigger: container,
pin: true,
scrub: true,
end: () => "+=" + container.offsetWidth,
matchMedia: {
"(min-width: 800px)": () => {
// Do Something
}
}
}
})