I am pretty new in JavaScript and JQuery and I have the following doubt about how exactly works this code that hide a div using a fadeout effect and in its place show another div using a fadein effect.
It works fine but I have some doubt about how exacty works.
So my code is the following one:
$("#inserimentoVariazioneAnticipo").fadeOut("slow", function() {
$("#confermaVariazioneAnticipo").fadeIn("slow");
});
I know that it is implemented in this way to make sure that the fadeIn() function isa called AFTER that the fadeOut() function is completely performed but I am finding some difficulties to understand why is implemented in this way.
I know that in JavaScript I can pass a function as parameter of another function.
Reading the official JQuery documentaion (http://api.jquery.com/fadeout/#fadeOut-duration-easing-complete) I find that:
.fadeOut( [duration ] [, easing ] [, complete ] )
so in this case I have that:
DURATION is setted to slow
EASINGis not specified so I think that it automatically use the default value swing (but I am absolutelly not sure about it)
COMPLETE: is the function that is performed after that the inovked fadeOut function completed its taks. So in this case after that complete its task it perform:
$("#confermaVariazioneAnticipo").fadeIn("slow");
that perform the fade in effect on the hidden div.
Is it my reasoning correct or am I missing something?