Any advice how i can do it via jQ? I would like to success only when all images too are ready.. thnks
$.ajax(
{
url: myUrl,
type: 'post',
data: postData,
success: function (resp)
{
$('#content').html($('#content', resp).html());
}
});开发者_Go百科
thnks
For this to work, you will need the special image load event plug-in. Otherwise, the event will not fire if the image is already in the browser's cache.
Then put this code inside your success handler:
var images = jQuery('#content img');
var imgcount = images.length;
images.load(function() {
imgcount--;
if (imgcount < 1) alert('All images are loaded.');
});
Please take the time to mark answers to your questions as Accepted, by clicking the checkmark next to the one you think is best. Thanks. :-)
精彩评论