I’m using GSAP SplitType to animate text in my portfolio, but I’m encountering an issue where the text breaks onto new lines, displaying incorrectly. I’ve attached some screenshots to illustrate:
- The text in VS Code (to show it as one continuous sentence with no breaks, as intended): (https://i.sstatic.net/lt4YRy9F.png)
- The HTML/data structure in the inspector during a live preview:(https://i.sstatic.net/AJJyU968.png)
- How the text is rendered on the page (which is not how I want it):(https://i.sstatic.net/65JQ5lEB.png)
The JS code I’m using:
<script> const myText = new SplitType('#my-text') gsap.to('.char', { y: 0, stagger: 0.05, delay: 0.2, duration: .1 }) </script>
Does anyone know how to prevent the text from breaking onto new lines and ensure it displays as one continuous sentence?
Thanks!
Ethan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.