title: Official way to ask jQuery wait for all images to load before executing something
body: <p>In jQuery when you do this:</p>
  
  <pre><code>$(function() {
     alert("DOM is loaded, but images not necessarily all loaded");
  });
  </code></pre>
  
  <p>It waits for the DOM to load and executes your code. If all the images are not loaded then it still executes the code. This is obviously what we want if we're initializing any DOM stuff such as showing or hiding elements or attaching events.</p>
  
  <p>Let's say though that I want some animation and I don't want it running until all the images are loaded. Is there an official way in jQuery to do this?</p>
  
  <p>The best way I have is to use <code>&lt;body onload="finished()"&gt;</code>, but I don't really want to do that unless I have to.</p>
  
  <p>Note: There is a <a href="https://stackoverflow.com/questions/477463/jquery-is-waiting-for-images-to-load-before-executing-document-ready">bug in jQuery 1.3.1</a> in Internet Explorer which actually does wait for all images to load before executing code inside <code>$function() { }</code>. So if you're using that platform you'll get the behavior I'm looking for instead of the correct behavior described above. </p>