Hi,
I have a problem with jquery callback. The callback is executed before the fadeIn animation is completed. What im trying to do is, I want to replace an existing image with a new image and resize the new image to a specific size.
var filepath = "images/test.jpg";
$('#imagewrap').css('background-image', 'url("images/loader.gif")');//display a loading gif
$('#uimage').hide();//hide the current image
var i = $('<img />').attr('src', filepath).load(function()//load the new image
{
$('#uimage').attr('src', i.attr('src'));//change the src to new image
$('#imagewrap').css('background-image', 'none');//hide the loading gif
$('#uimage').fadeIn('slow', resize());//fade in the new image
});
function resize()
{
alert($('#uimage').width());//it shows the width of the previous image
}