Posted June 6, 2014 Hi, my onComplete doesn't appear to be firing, please can someone advise why. TweenLite.fromTo(obj,1, {height:minHeight+curHeight},{height:minHeight, onCompleteParams:[obj], onComplete:function(obj){obj.toggleClass('active')}}); Thanks 1DMF Share this post Link to post Share on other sites
Posted June 6, 2014 No idea; that looks fine to me. It would help if you made a demo showing this issue in codepen or jsfiddle so we could investigate. Share this post Link to post Share on other sites
Posted June 6, 2014 Well I replaced the anonymous function with a real one and it's working? Though the params don't seem to work, so I've done it like this... TweenLite.fromTo(obj, 1, {height:minHeight+curHeight}, {height:minHeight, onComplete:toggle(obj)}); Regards, 1DMF Share this post Link to post Share on other sites
Posted June 6, 2014 (edited) However, I have just found that the onComplete is firing instantly and not on completion of animation? What am I doing wrong? UPDATE: OK, so if you use parentheses and try to pass in arguments or void, the function fires immediately, so I went back to onCompleteParams and found that they must follow the onComplete special property. In my original example I had the onCompleteParams before the onComplete, which appears not to work. This is now working as desired... TweenLite.fromTo(obj, 1, {height:minHeight+curHeight}, {height:minHeight, onComplete:toggle, onCompleteParams:[obj]}); Edited June 6, 2014 by 1DMF Share this post Link to post Share on other sites
Posted June 6, 2014 Ah cool thanks for replying with your results. I'd never tried ordering them that way before and just assumed it would work ...which it does....... Share this post Link to post Share on other sites
Posted June 6, 2014 No problem, I absolutely love GSAP and hope it helps others. Share this post Link to post Share on other sites
Posted June 6, 2014 Hmmm.. that is weird .. I just made an example of the placement of onComplete after the onCompleteParams .. in a fromTo() and the onComplete fires as expected: http://codepen.io/jonathan/pen/xtkej Do you see it too? Share this post Link to post Share on other sites
Posted June 6, 2014 Yea totally working for me too. It's even working when I copy the exact tween (with valid height values) into your pen http://codepen.io/anon/pen/lnItb Back to square one - we have no idea why that didn't work for you... 1 Share this post Link to post Share on other sites
Posted June 6, 2014 yep, your pen works for me too Jamie Share this post Link to post Share on other sites
Posted June 6, 2014 ? who knows.. all working now, so all good Share this post Link to post Share on other sites
Posted June 6, 2014 The order shouldn't matter at all. I bet there was something else going on in your code previously that caused things not to work, but I'm glad to hear it's working for you now. If you can show us a way to reproduce the faulty behavior, please do. Otherwise, good luck with the project. Happy tweening. Share this post Link to post Share on other sites