Problem with jQuery animation
Posted
by Daemon
on Stack Overflow
See other posts from Stack Overflow
or by Daemon
Published on 2010-04-02T22:21:53Z
Indexed on
2010/04/02
22:23 UTC
Read the original article
Hit count: 168
I have a problem with an animation in jQuery using ajax.
On the click of an button (actually an tag), I call a ajax method, and have the following written inside the success parameter:
success: function(msg) {
$('.ContentsMainRight').children().fadeOut(500, function() {
$('.ContentsMainRight').html(msg.d);
$('.ContentsMainRight').children().fadeIn(1000);
});
},
This have the following result.
The contents of a div fade out over 500ms as it's supposed to. Then the html contents of the div are swapped, but then the last part did not work as I hoped. The html returned by the ajax method include some text inside a
tag, and a image inside a tag. The result is that the text is automatically displayed instantly with no fadein, but the img that is put fades in over 1 second. Why is the text and image treated differently?
-Daemon
© Stack Overflow or respective owner