Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Arrg. TimelineMax onComplete being fired more than once

Recommended Posts

I was about to launch my site when I realize some inconsistent behavior with the onComplete callback. It works fine (i.e., fire the onComplete event just once) about 90% of the times in Chrome, and it is even more inconsistent on Safari and Firefox. For the latter two browsers, onComplete is being fired more than once often, and sometimes twice, and sometimes thrice, and sometimes once. 

if (this.tl) {

this.tl = new TimelineMax({delay: 0});

this.tl.staggerTo(arrayOfElements, 0.55, {
onComplete: function () {
// The Console is logging this more than once sometimes, and sometimes just once, depending on the browser
console.log ("staggerTo Complete");
autoAlpha: 0,
y: "50",
ease: Expo.easeOut
}, 0.06, "+=0.08");
Link to comment
Share on other sites



This is the one, I presume:

this.tl.eventCallback("onComplete", function () {
console.log ("Should fire once at the end of the timeline" );
} );
Link to comment
Share on other sites

I would be very interested in seeing a demo that shows the same code working differently between browsers.

The way your code is set up is that "staggerTo complete" will fire after each tween in the stagger completes.


Here is a demo that shows how to use the onCompleteAll parameter in a staggerTo.




Notice how the message "all tweens are done" only appears once.

  • Like 1
Link to comment
Share on other sites

Oh, i see your other post about the eventCallback.

I wonder if the way you are invalidating the timeline is related to the issue. Regardless, a demo will help



Link to comment
Share on other sites

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.