Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugs with gsap scrolltrigger in Safari #270

Open
Christoph13524 opened this issue Aug 12, 2023 · 3 comments
Open

Bugs with gsap scrolltrigger in Safari #270

Christoph13524 opened this issue Aug 12, 2023 · 3 comments

Comments

@Christoph13524
Copy link

Christoph13524 commented Aug 12, 2023

I experience bugs when used together with gsap scrolltrigger. Page works without problems without lazyload with scrolltriggers but when adding lazyload things start to be different. Lazyload somehow breaks the scrolltriggers and I have to refresh them in order to make it work again. Scrolltriggers start to be at wrong places when using lazyload.

Tested in Safari. Chrome and Firefox seem to have less issues.

Is this a known issue?

@grebjamin
Copy link

grebjamin commented Aug 18, 2023

I've stumbled upon this issue in safari as well. And as you say, the scroll trigger seems to work fine on Chrome and Firefox.

@Christoph13524 Christoph13524 changed the title Weird behaviour with gsap scrolltrigger Buggy behaviour with gsap scrolltrigger in Safari Aug 18, 2023
@Christoph13524 Christoph13524 changed the title Buggy behaviour with gsap scrolltrigger in Safari Bugs with gsap scrolltrigger in Safari Aug 18, 2023
@aashankhan2981
Copy link

aashankhan2981 commented Jan 25, 2024

Experiencing a similar issue here – my GSAP ScrollTriggers are exhibiting unexpected behavior in Safari, whereas they function correctly in Chrome. Below is a snippet of the code:

useEffect(() => {
  let trigger;
  const timeout = setTimeout(() => {
    trigger = ScrollTrigger.create({
      trigger: "#simulator-section",
      start: "top bottom",
      onUpdate: ({ progress }) => {
        lottieRef.current?.goToAndStop(progress * 2 * lottieRef.current.totalFrames, true);
      },
      // pin: true,
    });
  }, 1000);

  return () => {
    trigger && trigger.kill();
    clearTimeout(timeout);
  };
}, [lottieRef]);

@Christoph13524
Copy link
Author

I gave it another shot with:
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js
https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js
//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.11/jquery.lazy.min.js
//cdnjs.cloudflare.com/ajax/libs/jquery.lazy/1.7.11/jquery.lazy.plugins.min.js

Seems like the new version of gsap and scrolltrigger has changed something but made it even worse.

In general, lazyload still breaks the scroll trigger position --> it is not where it should be.

That kind of worked (with a workaround) before with older versions of gsap/scrolltrigger: The workaround was to update the scrolltrigger frequently (every 2 sec was enough while scrolling in my case):
window.addEventListener("scroll", function () { ScrollTrigger.refresh(); }, 2000);

That is by far not an elegant solution!

Today I tried it with the latest versions of gsap/scrolltrigger. Not changing anything, the scrolling of the whole website was completely buggy and glitchy. Feels like every scroll movement the website jumps 100px up and 100px down.

I then removed:
window.addEventListener("scroll", function () { ScrollTrigger.refresh(); }, 2000);

--> Scrolling was again how it is supposed to be, but still the same issue of wrong scrolltrigger trigger position came back.

Now I again gave up and switched back to the old gsap versions (3.9.1).

Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants