Answer the question
In order to leave comments, you need to log in
How to add/remove class at start and end of tweenmax animation?
How can I add the class as the animation started and remove the class when it ended.
var tl = new TimelineLite();
tl.from('#heroPreloader', 2, {onStart: onStart, onComplete: onComplete})
.from('#heroContent', 3, {autoAlpha: 0});
function onStart() {
tl.set('#heroPreloader', {className: '+=preloader_show'});
}
function onComplete() {
tl.set('#heroPreloader', {className: '-=preloader_show'})
}
Answer the question
In order to leave comments, you need to log in
The documentation says that the first argument to set() should be an object, not a string. Replace with $('#heroPreloader')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question