I'm using scrolltrigger to pin and scrub an element on a couple of pages. I'm trying to have the element scroll down the page as the user scrolls, then stop at a certain point. The issue is that it doesn't always scroll all the way down, and sometimes it doesn't render the full size of the element, especially on first load of the page, hence the incognito window usage. When the page is refreshed it works more often than not, however sometimes also doesn't work...
Please have a look at the following video to see what I'm talking about, please note the jumpyness of the element happens because I set a delay on the gsap function thinking it might help, but didn't.
Using GSAP 3.9.1
GSAP code I'm using:
function myGSAPToDelay() {
gsap.registerPlugin(ScrollTrigger);
gsap.to(".toTranslateY", {
scrollTrigger: {
trigger: ".toTranslateY",
pin:".toTranslateY",
start:"top center",
end: () => `+=${window.getComputedStyle(document.querySelector('.lo-pro-timeline-control'), ':after').height}`,
pinSpacing:false,
scrub:true,
pin:true
/*markers: true*/
},
});
}
const loproTimeout = setTimeout(myGSAPToDelay, 2000);
Link to a page (still a work in progress): https://www.ledrabrands.com/alphabetlighting/rgbw/
P.S I'm a Javascript and GSAP beginner. Please let me know if you need more info. Thanks!