How to delay some jQuery / JavaScript function until all the images on the page have finished loading? In fact, the jQuery function I'm talking about is designed to set the offset position for a div. The problem is that the page resizes after the images are fully loaded, so the offset is wrong.
For the jQuery function, refer to this question: Problems with a fixed div at the bottom of the page that stops at this location
You can use the event onloadthat fires after all images or external resources are loaded:
onload
$(window).load(function(){ // your code here, all images loaded });
load :
load
$('img.ImageClass').load(function(){ // The image loaded.... });
,
function newfunction(){ //put all the stuff here }
$('img').load(function(){ newfunction() })
.