Ivan Mocs Posted February 14, 2023 Share Posted February 14, 2023 How do I add a delay only on the first page load. I don't want any delay while scrolling. ScrollTrigger.batch(".fadeup-startup", { onEnter: elements => { gsap.from(elements, { autoAlpha: 0, y: 60, stagger: 0.2, delay: 2.3 }); }, once: true }); Link to comment Share on other sites More sharing options...
Solution GreenSock Posted February 14, 2023 Solution Share Posted February 14, 2023 Maybe just check to see if it's within a certain amount of time since load? let isStartup = true; window.addEventListener("load", () => { setTimeout(() => isStartup = false, 3000); // after 3 seconds, set isStartup to false }); ScrollTrigger.batch(".fadeup-startup", { onEnter: elements => { gsap.from(elements, { autoAlpha: 0, y: 60, stagger: 0.2, delay: isStartup ? 2.3 : 0 }); }, once: true }); Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now