user1617218
user1617218

Reputation:

Ajax Load with fade in

i'm trying to load with a fade in an html with ajax. It loads but with no fade, I don't know what i'm doing wrong, here it's my code:

$("#artworks").click(function(){
// load artworks page
    $("#content").load("artworks.html"); function(){
    $(this).fadeIn("slow");
    });
});

it get's an error, what's my mistake?

Upvotes: 4

Views: 1403

Answers (2)

11684
11684

Reputation: 7517

Perhaps you mean:

$("#artworks").click(function(){
// load artworks page
    $("#content").load("artworks.html", function(){
        $(this).fadeIn("slow");
    });
});

This will only work if #content is invisible before the AJAX-load.

Upvotes: 3

Barrie Reader
Barrie Reader

Reputation: 10713

$("#artworks").click(function(){
    $("#content").load("artworks.html"); function(){
    $(this).fadeIn("slow");
    });
});

SHOULD BE

$("#artworks").click(function(){
    $("#content").load("artworks.html", function(){
      $(this).fadeIn("slow");
    });
});

NOTE THE CHANGE OF ; TO , AND THE MOVEMENT OF THE )

Upvotes: 3

Related Questions