Jump to content
Search Community

ScrollTrigger sometimes works, sometimes not

Zoker test
Moderator Tag

Go to solution Solved by Cassie,

Recommended Posts

Hi there,

 

I just tried to create a scroll trigger, which will change the opacity and position based on the scroll progress:

gsap.from('.a-f-r', {
    scrollTrigger: {
        trigger: ".a-f-r",
        start: "top bottom",
        end: "center bottom",
        scrub: 1
    },
    x: 1000,
    opacity: 0
});

Now the issue is, that this works sometimes and sometimes does not. When I reload the page the chances are 50/50 that it works.

When it does not work, the opacity just stays 0 and the element is hidden.

 

The page does not use any caching yet or any other optimization. The site can be found here: https://shorturl.at/bjmzO

The above code is located in the animation.js file

 

Is there any way I can make this reliable? 

 

Thanks!

Link to comment
Share on other sites

  • Solution

Hey @Zoker Looks like it's down to a regression in the latest version. Sorry about that!

Fixing options! 

  • Step back the version to 3.8
  • Use the latest beta 
  • Fix it for the current version by setting lazy: false on your .from() tween(s). 

 

 

 

See the Pen NWaQYVY?editors=1010 by GreenSock (@GreenSock) on CodePen

 

(You'll also need to load your GSAP script before the scrollTrigger script in your codepen JS panel.)

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...