Share Posted April 4, 2013 Hi, I just updated GSAP to the latest version and am now noticing an error that's happening with class names. I have a div element with multiple class names. <div class='myclass one default'>...</div> If i run this: TweenLite.to( '.myclass', 3, { className: '-=default' } ); There are spaces being removed and result in the following which breaks not only the CSS rules but also any jQuery calls to this element (e.g. $('.myclass.one') ). <div class='myclassone'>...</div> Everything was working fine until I upgraded to the latest version. Any suggestions? Link to comment Share on other sites More sharing options...
Share Posted April 4, 2013 Sorry about that - it was indeed a regression that only affected className tweens with "-=" prefixes and 3 or more classes, but I just posted an update (literally added a single space to the code in one spot) and uploaded that now. It's in the zip download and on github. It's not on the CDN yet. Again, I apologize for the glitch. Link to comment Share on other sites More sharing options...
Author Share Posted April 4, 2013 Best support on the planet. Fixed and THANK YOU. Link to comment Share on other sites More sharing options...
Author Share Posted April 4, 2013 Found one more issue with this. If you use +=someClass on an element that already has .someClass, it creates a duplicate class instead of intelligently checking that the class already exists. So now you end up with <div class='someClass someClass'>...</div> Here's a quick example http://jsfiddle.net/943mD/ Link to comment Share on other sites More sharing options...
Share Posted April 4, 2013 I don't think that matters functionally, but we'll get it patched in the next release. Thanks for pointing that out. Link to comment Share on other sites More sharing options...
Author Share Posted April 4, 2013 Thanks. So i guess then, for any Tween using -= or += with the className property, I would need to handle duplicate classes via jQuery.removeClass('...') beforehand? The catch is I'm stitching multiple tweens together using TimelineLite that are using -= or += for className so I need to figure out a way to remove the class (using jquery) right before I add the tween +=class back in. Does that make sense? Thoughts? Link to comment Share on other sites More sharing options...
Share Posted April 4, 2013 This should be fixed now in the latest push (uploaded a few minutes ago) Link to comment Share on other sites More sharing options...
Author Share Posted April 4, 2013 You're a scholar and a gentleman. Link to comment Share on other sites More sharing options...
Author Share Posted April 4, 2013 Works perfectly now - thank you again for the amazing work on this library and the stellar support. 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