1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
$('#content').waitForImages(function() { //console.log('content loaded'); $bar.css({ width: '100%' }); $c.fadeOut('slow'); }, function(loaded, count, success) { var p = (loaded / count) * 100; //console.log(p); //console.log(loaded + ' of ' + count + ' images has ' + (success ? 'loaded' : 'failed to load') + '.'); $bar.css({ width: p + '%' }); }, true); |
The third param is very important! Set it “true” to include background images.
Reference: