Is there a way to divide text without including line breaks?

As I delve into SplitText, the GSAP plugin, a peculiar observation surfaces - it alters the;

<br> 

tag within my element (uncomment the first line in javascript to witness the transformation). Take a look at this example: https://codepen.io/anon/pen/vpWWJJ

The curiosity strikes me: Why does this modification occur and is there a way to restore the original state before applying SplitText? (How can I keep the line break intact?)

Your insights are greatly appreciated! Best regards, John

Answer №1

Divide your text into two distinct sections with unique identifiers and introduce them separately:

let sectionOne = new SplitText("#sectionOneID");
let sectionTwo = new SplitText("#sectionTwoID");

let timeline = new TimelineMax({});
timeline.timeScale(1);
timeline.staggerFrom(sectionOne.words, 1, { opacity: 0, x: 5, ease: Power1.easeOut}, 0.01)

timeline.staggerFrom(sectionTwo.words, 1, { opacity: 0, x: 5, ease: Power1.easeOut}, 0.01)

https://codepen.io/anon/pen/mpqqNj

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can you calculate the time difference between two distinct dates along with their timestamps?

In my HTML, I have set up four fields. Two of these fields are for selecting dates using datepickers (one for the from-date and one for the to-date), while the other two fields are for selecting times using timepickers (one for the from-time and one for th ...

Combine two redux actions and access the modified state in the second action

I'm facing a dilemma with a straightforward problem that I believe I have a solution for, but I'm uncertain about the effectiveness of my idea. Essentially, in the current state of things, I have an array property that requires updating just bef ...

What is the most efficient method for iterating through APIs?

There are too many loops in this API, causing it to run slowly. We need to optimize the code to handle different time frames efficiently, such as day, month, and week. Running the same code for different intervals is slowing down the process. // Optimize ...

Avoiding the inclusion of special characters in symfony css selectors, or utilizing wildcard characters for more

Currently, I am utilizing the Symfony\Component\DomCrawler\Crawler component in order to locate a form that contains a name with various CSS special characters. <input name="myfield[0].thing"> In my code, I have: $messageElement = $ ...

Managing Javascript's async/await behavior when encountering errors

Exploring the benefits of ES6 Async/Await, I found it much more user-friendly to work with async/await compared to Generators and Promises. An example scenario is when calling a promise function (getActiveSession in the code snippet below) from within an ...

What are the reasons behind the issues encountered when enabling "Optimization" feature in Angular that affect the proper rendering of PrimeNg elements?

Angular Version : 9.x Primeng Version : 9.x We've encountered an issue with PrimeNg elements not rendering correctly in our dev/prod environments, although they work fine in the local environment. After some investigation, we found that the culprit ...

How can I change the color of a designated column in a Google stacked bar chart by clicking a button?

I am in the process of creating a website that compares incoming students at my university across different academic years. We have successfully implemented a pie chart to display data for the selected year. Now, we aim to include a stacked bar chart next ...

Learn how to showcase video information in a vue.js template

I am having difficulty displaying a saved media (video) file on another page after collecting it using the ckeditor5 media option. The data is stored along with HTML tags generated by ckeditor, so I'm using v-html to display other content like <p&g ...

Having issues changing the color of fontawesome icons

I am struggling to change the color of a fontawesome icon when it is clicked. <a id="thumbsup">@Html.FontAwesome(FontAwesomeIconSet.ThumbsUp, FontAwesomeStyles.Large2x)</a> My goal is to have the icon start off as gray, turn blue when clicke ...

Using JavaScript, capture the current date and time and store it in a .txt file with the corresponding format

Objective: Upon clicking the download link, an automatically named file will be downloaded with today's date and time format. For example, 7-3-2021 04:04:00 PM or any applicable format with the date and time included in the name. Below is the code sn ...

Is it possible to implement a route within a controller in Express.js?

In my controller, I currently have the following code: module.exports.validateToken = (req, res, next) => { const token = req.cookies.jwt; //console.log(token); if (!token) { return res.sendStatus(403); } try { const ...

The accuracy of IE9 <section> is not quite up to par

When viewing This Page in IE9, the element section#tcs-website-content appears as 990px wide even though its CSS property is set to width: 100%. This occurs despite all parent elements also having a width of 100%, resulting in a browser width of 1024px. A ...

React displays an empty page when non-default routes are accessed in the build phase

<Router> <Switch> {console.log("Loading Routes")} <Route path="/booking" component={Booking} /> <Route path="/bookings" component={Bookings} /> <Route path=&quo ...

Send a file using ajax with the help of JavaScript and PHP

Currently, I am looking to implement a method for uploading files using Ajax and JavaScript/PHP without having the page refresh. My initial thought is to use Ajax to send the file using xmlhttp.send(file) and then retrieve it in the PHP script, but I' ...

Gaining entry to a JavaScript prototype method

I'm currently working on a prototype function called event. Prototype Func("input_element_id").event("keyup",function(){ alert("Works on keyup in an Input!"); } Func.prototype= { keyup: function(func){ //adding event listener and c ...

Is there a way to display my array within my React component using JavaScript?

I am working with an element that looks like this: const DropdownElements = [ { key: 1, title: "City", placeholder: "Select City", apiUrl: "https://api.npoint.io/995de746afde6410e3bd", type: "city&qu ...

Incorporate an external JavaScript script using code

I'm currently working on integrating a map widget from 'Awesome Table' into the codebase of an open-source CRM platform. The specific code snippet I need to add is <div data-type="AwesomeTableView" data-viewID="-KLtnY5OHJPgnEOX1bKf"> ...

Setting a TypeScript collection field within an object prior to sending an HTTP POST request

Encountered an issue while attempting to POST an Object (User). The error message appeared when structuring it as follows: Below is the model class used: export class User { userRoles: Set<UserRole>; id: number; } In my TypeScript file, I included ...

Avoiding leaps through the use of dynamic pictures?

Currently, I am implementing the picture element along with srcset to download the same image but in varying resolutions depending on the screen size of the device. The image has a style of max-width: 100%, causing it to shift the content below when downl ...

Utilizing v-for in Vue with TypeScript to generate multiple checkboxes

My goal was to capture the values of checkboxes and store them in an array using v-model. However, I encountered an issue where the first time I toggle a checkbox, it doesn't register. Only after checking a second box and hitting submit does the secon ...