Ajax Load Fade Out

I am trying to load using fj in html with ajax. It loads, but without fading, I don’t know what I am doing wrong, here it is my code:

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

he gets an error, what is my error?

+4
source share
2 answers
 $("#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 CHANGE ; TO , AND MOVEMENT )

+3
source

Perhaps you mean:

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

This will only work if #content invisible before loading AJAX.

+3
source

Source: https://habr.com/ru/post/1439377/


All Articles