Jump to content
Search Community

GSAP ScrollTrigger + Split Text on multiple elements

lukestoked test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hi,

 

I'm trying to add this SplitText feature to my site but I'm having trouble getting individual timelines for each of the p tags in my codepen (this will be changed to a class in future) 

I ideally want the first paragraph to start as it is scroller in to view but currently that triggers the one lower done the page to start at the same time.

 

Some pointers would be greatly appreciated.

 

Thanks,

Luke

See the Pen GRPmPEP by luke-stoked (@luke-stoked) on CodePen

Link to comment
Share on other sites

  • Solution

I heard you liked .forEach() loops, so I put .forEach() loops inside your  .forEach() loops.

 

This is just a scoping issue and getting all the p elements on the page first and then do all the logic in the forEach fixes this. Hope it helps and happy tweening! 

 

See the Pen xxmPPQB?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

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