Jump to content
Search Community

Issue with <br> and Text Plugin

Lorenzo Migliorero

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Lorenzo Migliorero
Posted

Hi guys, i have a little problem with the awesome text plugin...

It is possible to exclude <br> from the tween parser, and put in the the string as complete tag in a single step?
 
For example:
 
abc<br>abc became
a - b - c - <br> - a - b - c
 
and not
a - b - c - < - b - r - > - a - b - c
 
Thanks for the answers,
Lorenzo
Posted

Hi and welcome to the GreenSock forums.

 

Sorry, our TextPlugin is currently designed only to handle animating plain text chars. 

Unfortunately, its not something we can accommodate quickly.

It's certainly a valid feature request and perhaps something we'll be able add in the future.

 

 

Thanks for asking.

  • Like 1
  • 3 years later...
Ishvar akhaja
Posted

Replace br with some tag and then replace again that with br and then give span some css

      

$demoText.html( $demoText.html().replace('<br>', "^").replace(/./g, "<span>$&</span>").replace(/\s/g, " ").replace('^', "<br>"));
jQuery('br').parent('span').addClass('test');

          

span.test {
    display: block !important;
    height: 0;
}

 

Posted

Hi ishvar, might help to see a demo of what you are trying to explain. Not entirely clear without html and animation code. Thanks for sharing.

 

Feel free to

See the Pen GqKrxG by GreenSock (@GreenSock) on CodePen.

.

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...