havingagoatit
havingagoatit

Reputation: 583

Jquery complete execution of animation even after timeout

So I have the script that is executed on page load..

$(document).ready(function() {
    setTimeout(function() {
        $("#loader-wrapper .loader-section, #textbit").hide("slow");
        $("#logo").animate({
            left: '-115px',
            top: '-60%'
        });
        $("#logo-side").animate({
            opacity: 1
        }, 3000);
        $("#wrapper").unwrap();
    }, 2000);
});

basically I want #logo-side to fade in AFTER the setTimeout and not sure how to script it. Can someone help ?

Upvotes: 2

Views: 101

Answers (2)

havingagoatit
havingagoatit

Reputation: 583

Still no answer as to why it wouldnt fade in properly if something els happened but it is probably down to the initialisation of a multipushmenu that stops every function before it does its own stuff... crazy really but there we are !

Upvotes: 0

Nishit Maheta
Nishit Maheta

Reputation: 6031

use animate callback function on $("#logo"). read more about animate

   $(document).ready(function() {
     setTimeout(function() {
        $("#loader-wrapper .loader-section, #textbit").hide("slow");
        $("#logo").animate({
          left: '-115px',
          top: '-60%'
        },'slow',function(){
           $("#logo-side").animate({
           opacity: 1
           }, 3000);
       });

       $("#wrapper").unwrap();
    }, 2000);
 });

Upvotes: 2

Related Questions