Adapted from download documentation ()
Download event warnings when used with images
The common problem developers are trying to solve with .load () is that the shortcut should function when the image (or image collection) is fully loaded. There are several well-known reservations with this to be noted. It:
It does not work consistently and not reliably, cross browser
WebKit does not work correctly if src is set to src, as before
Incorrectly inverts the DOM tree
**** May stop starting for images that are already in the browser cache ****
Especially the latter is a common problem.
You can try imagesLoaded plugin , but I got lucky with the following approach:
var element = $('#my-img'); $("<img/>").load(function () {
This is dirty, but if you really need to perform some action after loading the image, this was the only reliable approach I was able to work with.
source share