2

I'm trying to execute a function after the page is completely loaded (including images) by using

$(window).load(function() { ... });

However, this function is executed when the DOM is loaded (without waiting for the images).

Have you got any idea what could be the problem ?

Antoine Delia
  • 1,728
  • 5
  • 26
  • 42
  • Look here: http://stackoverflow.com/questions/588040/window-onload-vs-document-onload – SharpEdge Jun 03 '15 at 13:04
  • Refer here http://stackoverflow.com/questions/1435015/how-can-i-make-the-browser-wait-to-display-the-page-until-its-fully-loaded – Dimag Kharab Jun 03 '15 at 13:07
  • possible duplicate of [Official way to ask jQuery wait for all images to load before executing something](http://stackoverflow.com/questions/544993/official-way-to-ask-jquery-wait-for-all-images-to-load-before-executing-somethin) – iamawebgeek Jun 03 '15 at 13:10
  • 1
    Are you sure the images that aren't loaded before the event are not `subsequent` images? window.onload will fire after the HTML, JS scripts, CSS files and IMG files in the body have loaded. It will not wait for any referenced assets, e.g. background images referenced in CSS, or IMG elements created dynamically. – Sergey Snegirev Jun 03 '15 at 13:11

1 Answers1

1

Maybe you could test this jQuery plugin: waitForImages

M.R.Karimi
  • 95
  • 9