108saimon
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by 108saimon
-
-
Hi, Everyone!
I faced some problem in my code. Maybe i just not understand GSAP api.
I have code like :$('a').click(function(e){ event.preventDefault(); var thishref = this.getAttribute('href'); //code down for some animation before redirect, in this example very simple TweenMax.to('body', 0 , {display: 'none', delay: 1, onComplete : href_redirect(thishref) }); }); function href_redirect(t_href) { document.location.href=t_href; }
in theory sequencing be like : click to link > my animation start > my animation end > redirect .
but in real - instant redirects, without waiting animation end.
in now i forced use code like :$('a').click(function(e){ event.preventDefault(); var thishref = this.getAttribute('href'); TweenMax.to('body', 0 , {display: 'none', delay: 1, onComplete : href_redirect(thishref) }); }); function href_redirect(t_href) { setTimeout(function(){document.location.href=t_href;},3000); // delay manually }
Someone please answer me - what i doing wrong in first example.
onComplete not work correctly or i dumb?
in GSAP
Posted
Sorry, a find answer.
Need use some like :