Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

SplitText weird line breaks

Recommended Posts

Hey guys, I need a little help with splitText weird behaviour. Every single time i visit the staging site, splitText split lines wrongly. 
I have to refresh and then everything looks, ok. Same thing when i resize the browser the text is not wrapping automatically like it should. Do you have any ideas of what might be wrong? 

I use intersectionObserver to detect the item in viewport and then triggering the TweenMax function. 
Thank you very much



See the Pen dyyrYgV by jurajmolnar (@jurajmolnar) on CodePen

Link to comment
Share on other sites

Hey @Juraj,,


You could call your function with an onComplete


stAnim.staggerFrom(mySplitText.lines, 2, {
    opacity: 0,
    y: 30,
    transformOrigin: "0 0",
    rotation: 8,
    rotationX: 15,
    ease: Quart.easeOut,
  }, .175)  // .  }, .175, allDone);

  function allDone() {


Happy tweening ...



  • Like 3
Link to comment
Share on other sites

Hey Juraj, thanks for being a Shockingly Green member!


As mikel pointed out, SplitText isn't built to handle browser resizing so you need to handle it manually. Reverting it like what mikel did is a good option because it essentially removes the markup that SplitText adds after the animation.

  • Like 2
Link to comment
Share on other sites

Thank you both, I am a getting a bit smarter with greensock every day ;)

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