Hi community. I know minimal demo is a core requirement for asking a question but I hope this would not require. In case, if it does, I will post the demo too. In my react app, when I click on the link and navigate to other route and after that if I click on the browser back button it does not scroll to the section where the link was placed (which is the default browser behavior) but as soon as I comment out my scroll trigger, it starts working fine. Here is my gsap settings
useLayoutEffect(() => {
const mediaQuery = window.matchMedia('(min-width: 768px)');
// if (mediaQuery.matches) {
console.log('i am running')
const sliderTopDiv = document.getElementsByClassName('sliderTopDiv')
const slides = gsap.utils.toArray(".about");
const tl = gsap
.timeline({
scrollTrigger: {
trigger: sliderTopDiv,
start: "50% 50%",
end: "+=" + 100 * (slides.length - 1) + "5",
pin: sliderTopDiv,
scrub: 0.1,
markers: false,
},
})
.to(slides, {
xPercent: -(100 * (slides.length - 1)),
ease: "none",
});
const images = gsap.utils.toArray(".aboutImg");
images.forEach((image, index) => {
gsap.from(image, {
opacity: 0.2,
scale: 0.5,
transformOrigin: "center center",
ease: "none",
scrollTrigger: {
trigger: slides[index],
containerAnimation: tl,
start: "left 75%",
end: "left 25%",
//markers: { startColor: "fuchsia", endColor: "fuchsia" },
scrub: true,
}
});
});
tl.progress(1).progress(0)
;
}, []);
My slider animation is working perfectly fine, I have excluded the imports from the post