Jump to content
Search Community

SplitText breaking lines on span (inconsistently)

MeLight test
Moderator Tag

Recommended Posts

Hi guys,

 

I'm doing an engine for text animations. Worked great till I introduces some font-size changes. The attached code pen shows the basic code (supposedly same code as the breaking code). But I couldn't reproduce the probelm in the codepen.

 

Structure looks like this:

<span>emoji code</span> Sale text goes here <span>emoji code</span>

 

When applying certain font-size (smaller!), the emoji spans (i tried text as well) are converted to separate lines by SplitText. Attaching two links where the problem shows:

 

http://mega-sale-qa.appspot.com/bars/preview?&effect=wave-explode&emoji=0x1f385&font_size=35 - font size 35 (all good)

http://mega-sale-qa.appspot.com/bars/preview?&effect=wave-explode&emoji=0x1f385&font_size=32 - font size 32 - makes lines!

 

Please advise. Thanks

 

See the Pen GRJzvVe by melightk (@melightk) on CodePen

Link to comment
Share on other sites

I'm looking into it, but the problem is that you're using a different font-size that triggers it to be interpreted as a different line (because the top of the containing <div> is sufficiently different, past the threshold). For now, you could split with type: "words,chars" only, and then run your own logic to split that up by lines (if necessary). But again, I'm looking into a baked-in solution. This is definitely an edge case that I don't remember seeing in all the years since SplitText was introduced, but I have an idea that may work but it'll take some time to attempt. I'll get back to you as soon as I can. 

  • 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.
×
×
  • Create New...