Jump to content
Search Community

108saimon

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by 108saimon

  1. Sorry, a find answer.

    Need use some like :

     

    $('a').click(function(e){
            
            event.preventDefault();
            
            var thishref = this.getAttribute('href'); 
            
            TweenMax.to('body', 1 ,  {opacity: 0, onComplete : href_redirect, onCompleteParams:[thishref] }); // use onCompleate + onCompleteParams 
            
            });
        
        function href_redirect(t_href) {
            document.location.href=t_href;
        }
    
    • Like 1
  2. 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. 

×
×
  • Create New...