Execute jQuery code when images have loaded from external resource

Posted by Nick Swan on Stack Overflow See other posts from Stack Overflow or by Nick Swan
Published on 2010-06-07T20:27:55Z Indexed on 2010/06/07 20:32 UTC
Read the original article Hit count: 225

Filed under:

Hi all,

I'm getting users profile pictures from Facebook so their loading time varies quite a lot. When they have loaded I want to resize them. I have the resizing code working OK, but cannot get the actual code to execute reliably at the right time. According to the info I've found this should work:

$('.userPic').load(function () {

... code to resize pictures

});

But it doesn't seem 100% reliable. Any other hints or tips?

Thanks Nick Swan

© Stack Overflow or respective owner

Related posts about jQuery