You can use my jQuery plugin called waitForImages , which will help with this ...
$("#box").css("background-image", "url(image.php)").waitForImages({ waitForAll: true, finished: function() {
Otherwise, do it manually ...
var image = 'image.php', img = $('<img />'); img.bind('load', function() { // Background image has loaded. }); img.attr('src', image); $('#box').css('background-image', 'url(' + image + ')');
alex
source share