Jim Tim Posted June 12, 2023 Share Posted June 12, 2023 hello guys i'm stuck with this bug. i'll explain the scenario. I'm trying to perform word by word animation. 1. in the output I want that white space so I added white-space: pre-wrap property. the output : with the space I expected. 2. but if alter the container using splitText it give some minor extra-space how to prevent. you can notice by the width difference. 3. if you uncomment the width you'll face overflow wrap issue due to that minor extra space. See the Pen XWybLjZ by dajeme7838- (@dajeme7838-) on CodePen Link to comment Share on other sites More sharing options...
Rodrigo Posted June 12, 2023 Share Posted June 12, 2023 Hi, This is because you are using a regular space. It's fixed when you use instead: See the Pen QWJjNKR by GreenSock (@GreenSock) on CodePen Also just in case is a good idea to wait for the fonts to be ready before creating your SplitText instances: document.fonts.ready.then(function () { // Create SplitText instances }); Hopefully this helps. Happy Tweening! Link to comment Share on other sites More sharing options...
Jim Tim Posted June 13, 2023 Author Share Posted June 13, 2023 @Rodrigo this does fix the issue. but in your solution, you are using only in the space after <br> tag. in my useCase the text content is dynamic I can't know what the user entered. check out this code-pen output. See the Pen qBQOaGa by dajeme7838- (@dajeme7838-) on CodePen if I use in all the spaces the splittext is unable to split the text by words instead it splits by line Link to comment Share on other sites More sharing options...
GreenSock Posted November 4, 2023 Share Posted November 4, 2023 Sorry about the delay, @Jim Tim. I've improved the next release of SplitText to accommodate this scenario - does this work better for you? See the Pen dyaOOdQ?editors=0010 by GreenSock (@GreenSock) on CodePen 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now