title: jQuery event for images loaded
body: <p>Is it possible to detect when all images are loaded via a jQuery event?</p>
  
  <p>Ideally, there should be a </p>
  
  <pre><code>$(document).idle(function()
  {
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>$(document).contentLoaded(function()
  {
  }
  </code></pre>
  
  <p>But I can't find such a thing. </p>
  
  <p>I thought of attaching an event like this:</p>
  
  <pre><code>$(document).ready(function()
  {
      var imageTotal = $('img').length;
      var imageCount = 0;        
      $('img').load(function(){if(++imageCount == imageTotal) doStuff();});
  }
  </code></pre>
  
  <p>But will this break if an image fails to load? It's critically important for the method to be called, and at the right time.</p>