Jump to content
Search Community

GSAP animation not working on very first load of the web page.

codechirag test
Moderator Tag

Recommended Posts

Hello my wonderful community, 

 

https://paretoweb.empyrealinfotech.net/

 

this is my website where I have used split-type with gsap animation my concern is that on very first load of the page animation except hero section doesn't work. and once we refresh the page all animations work fine. I don't understand why it that happening it is not throwing any error either. Need your help.

 

useGSAP(() => {
    
    const animText = gsap.utils.toArray("h1");
    animText.forEach((box) => {
      const splith1 = new SplitType(box, {
        types: "words, chars,lines"
      });
      gsap.from(splith1.chars, {
        display: "none",
        stagger: 0.05
      });
    });
    const animH2 = gsap.utils.toArray("h2");
    animH2.forEach((box) => {
      const splith2 = new SplitType(box, {
        types: "words, chars,lines"
      });
      gsap.from(splith2.chars, {
        display: "none",
        stagger: 0.05,
        scrollTrigger: {
          trigger: box,
          start: "top center"
        }
      });
    });
  });

 

Link to comment
Share on other sites

Hi @codechirag. It's super tough to troubleshoot a live site. There are way too many factors and we can't really tweak things to see what's going on. If you'd like some help, please provide a minimal demo, like a Stackblitz or CodePen. 

 

Here's a starter template you can fork: 

https://stackblitz.com/edit/react-cxv92j

 

Also keep in mind that Split-Type is not a GSAP product, so we can't really support that. Our tool is SplitText. 🙂

 

  • Like 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...