a callback function is something that runs after an action has been completed. This is what you need for what you are trying to achieve, I'm also going to chain the actions.

$("#div").fadeOut(500, function() {
        $("#div").load(url).fadeIn();
});


The 500 is the time in miliseconds it takes to fadeOut, 500 is half a second.


Sasser wrote:
hi

i'm new to jquery and got a problem concerning the preloading of
content.
before changing the content dynamically i want to fade it out. so i
tried this:

$("#div").fadeOut();
$("#div").load(url);
$("#div").fadeIn();

this works quite good. there is just the problem that the content
fades in immediately after fading out - there is no time for the
loading of content.

a guy in the irc-channel told me to use a callback function... but i
do not really understand :(

can anyone help me?
thanks!

Reply via email to