How do I delay some jQuery / JavaScript function until all the images on a page have finished loading?
Actually, the jQuery function I’m talking about is for setting the offset position for a div. The problem is that the page resizes once the images are loaded completely, so the offset is wrong.
For the jQuery function refer to this question: Issues with Fixed div on bottom of page that stops at given place
You can use the
onloadevent which runs after all images or external resources are loaded:You can also use the
loadevent for individual images and run your code when they have loaded: