I have noticed that ScrollTrigger briefly switches the scroll-behavior property of my scroller (the html element) from smooth to auto and back as it toggles between isActive states.
Is this known/intentional behavior? In my case, it breaks the functionality of a native "back to top" button on the same page because the automated scroll is halted shortly after crossing the isActive threshold.
I assumed using GSAPs own ScrollToPlugin would do the trick here but that didn’t help either. Neither did using zenscroll with window.noZensmooth set to true. Any help would be much appreciated.
Here is my code. I commented out the code I execute on toggle as it makes no difference to the behavior described above.
gsap.to(overlay[0], {
scrollTrigger: {
trigger: footer[0],
start: "top bottom",
end: "bottom top",
scrub: 1,
onToggle: (self) => {
if (self.isActive) {
// main.addClass("fixed bottom left right");
// spacer.removeClass("hidden");
// overlay.removeClass("hidden");
} else {
// main.removeClass("fixed bottom left right");
// spacer.addClass("hidden");
// overlay.addClass("hidden");
}
},
},
opacity: 1,
});