Antonio Pitasi
Antonio Pitasi

Reputation: 125

Animate function jQuery

I'm new here and I have a problem with the jQuery's function - "animate"

function myFunction(newpage) {
$('#loader').animate({opacity: 0.0}, 400, 'linear', function(){
    // callback of fadeOut()
    $(this).load(newpage + ".php #toload", function(){
        // callback of load()
        $('#loader').animate({opacity: 100.0}, 400, 'linear', function(){
            //callback of fadeIn()
            // (not relevant for my problem, I think)
            $.getScript("js/test.js");
        });
      });
   });
}

My problem is: the first "animate" works like a charm but the second "animate" loads the new content correctly, without the animation (a simple "fadeIn").

Anyone can help me? Thanks in advice!

P.S. Sorry for my english

Upvotes: 2

Views: 89

Answers (2)

Rorchackh
Rorchackh

Reputation: 2181

you might want to check something like this

$('#loader').hide().fadeIn(400, function () {
    ...
});

Upvotes: 0

user1432124
user1432124

Reputation:

Animation is working but it is so fast that you can't see it because you have specified opacity:100; in 400 millisecond

use {opacity: 1;} because opacity maximum value is 1 and min. value is 0

Upvotes: 2

Related Questions