Hi thank you for your prompt reply.
No that's not my issue, to have the scroll position move slightly on resize would not be an issue for me at all, my issue is that when resizing occurs the container and panels completely disappear from the window.
I apologize for the quality of the video but there was no other way i could get it below 1mb. after doing more digging around i found the resizing issue goes away if my scrollTrigger pinType is set to transform.
However I need it to remain fixed as the container panels get this horrible jarring rubber band effect on scroll as they move horizontally across the screen when the pin is set to "transform".
Is there a way i can keep my pinType as fixed but have it switch to transform during the resize event or any other workaround for this issue?
I'm still plugging away trying to find a way to make it work but without any luck . But I think I need to find a way for the scrollTrigger to behave like it does when the pinType is in "transform" during resizing while being in "fixed" mode.
Here is my container animation settings, (btw my main is the scroll-able element on my page):
setupAnimations() {
let sections = gsap.utils.toArray(".panel");
sections.forEach((section) => {
section.style.height = `${window.innerHeight * 1.2}px`;
});
this.scrollTween = gsap.to(sections, {
xPercent: -100 * (sections.length - 1),
ease: "none",
scrollTrigger: {
id: "hScroll",
scroller: "main",
trigger: ".container",
pin: true,
pinReparent: true,
scrub: 1.5,
anticipatePin: 1,
end: "+=3000",
},
});
And below is my setupScrollTrigger method:
setupScrollTrigger() {
let container = document.querySelector("main");
// Check if the container exists
if (container) {
ScrollTrigger.scrollerProxy(container, {
scrollTop(value) {
if (arguments.length) {
container.scrollTop = value; // setter
} else {
return container.scrollTop; // getter
}
},
getBoundingClientRect() {
return {
top: 0,
left: 0,
width: window.innerWidth,
height: window.innerHeight,
};
},
pinType: "fixed",
});
}
}
Desktop 2024.02.19 - 14.35.52.01.mp4