With my jquery I'm trying to make the transition from a message to a loading function easy on the eyes by animate the opasity of the message out, inserting the loading.gif and animating the opacity back in. It fails.
$('#powerSearchSubmitButton').click(function(ev) {
startLoad();
return false;
});
function startLoad() {
$('.message').each(function(i) {
$(this).animate({opacity: 0}, 500, function() {
$(this).html("<img src=\"/content/pics/loadingBig.gif\" alt=\"loading\" style=\"opacity:0\"/>");
$(this).animate({opacity: 1},500);
});
};
return true;
};
When I leave out the .html() call, it works fine (except off course the image is not there; So I think that it is beacuse the html isn't inserted with opacity:0; But when I inserted it with style="opacity:0" it cannot fade back in...
What am I doing wrong?