Jump to content

Aaron Robb

SplitText 'lines' removes <br> tags

Recommended Posts

Is there a way around the splitText setup with "type: "lines"" to ensure it doesn't remove line breaks (<br>) when the content is wrapped in a <p>??

When using "words" or "chars" it keeps the breaks as they are, but when "lines" is selected, it removes those breaks and doesn't create new lines for them. It seems to use the outer <p> tags as what it sees as breaks, even if there is a <br> inside.

Link to comment
Share on other sites

Hi Aaron,


SplitText should work with <br> tags. Do you have minimal demo that shows the issue?

Link to comment
Share on other sites

SplitText lines aren't designed to work with nested elements. Is there any reason you don't split the <p>?

Link to comment
Share on other sites

I was going for a 'slide in from below' effect on multiple paragraphs.

So this is what it would look like, and parts like the bolded areas should have line breaks, but since it strips out any line breaks, it just looks like one solid paragraph.

See the Pen MWOooNJ by aaronrobb (@aaronrobb) on CodePen

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.