hopefully someone can help me out because I'm a bit confused.
could someone point me into the right direction and tell me what I'm doing wrong?
as far as I know the default behavior should be the code defined inside the function and that should be overwritten by the gsap.matchMedia() right?
thanks in advance!
const imageScrollTriggerOptions = {
[Device.MOBILE as Device]: {
start: 'top top+=90px',
end: () => `+=${content.value.offsetHeight - 400}`,
},
[Device.TABLET as Device]: {
start: 'top top+=265px',
end: () => `+=${content.value.offsetHeight}`,
},
};
const mm = gsap.matchMedia();
// add a media query. When it matches, the associated function will run
mm.add('(max-width: 768px)', () => {
// this setup code only runs when viewport is at least 800px wide
gsap.to('.stacked-image-title-text__image-container:not(:first-child)', {
scrollTrigger: {
start: 'top top+=90px',
end: () => `+=${content.value.offsetHeight - 400}`,
},
});
});
const handleImageAnimations = (): void => {
tl.fromTo('.stacked-image-title-text__image-container:not(:first-child)', {
opacity: 0,
scale: 2,
}, {
duration: 0.6,
opacity: 1,
scale: 1,
stagger: 1,
scrollTrigger: {
pin: '.stacked-image-title-text__images-container',
scrub: 0.1,
start: 'top top+=265px',
end: () => `+=${content.value.offsetHeight}`,
},
});
};