title: $(window).load vs. window.addEventListener
body: <p>What is the difference between:</p>
  
  <pre><code>$(window).load(function() {
  loadSlideShow();
  }); 
  </code></pre>
  
  <p>and</p>
  
  <pre><code>window.addEventListener('load',loadSlideShow());
  </code></pre>
  
  <p>The function loadSlideShow() creates a slideshow; it waits for all of the images to load, and then adds the controls to the slideshow, in the middle of the image (it bases the position of the controls on the height of the image).</p>
  
  <p>When using window.addEventListener, the controls would sometimes be added before the image had actually loaded.  So the image height would be 0 and the controls would be placed at the very top of the slideshow, and not in the middle.</p>
  
  <p>Once I changed to $(window).load, the error went away.</p>
  
  <p>I'm not sure why there would be a difference between the two.</p>