title: jQuery $(window).load not working as expected
body: <p>I ran into an something that did not expect today when removing part of a function that previously was loaded in my asset pipeline but needed to be extracted to a partial for some A/B testing.</p>
  
  <p>I'm using the bigVideo.js library to load a full-screen video on the page. BigVideo.js started loading the wrong dimensions today when I extracted the code to the partial. The partial loads below the rest of my javascript assets.</p>
  
  <p>I previously had the code incapsulated in a anonymous function inside my normal asset pipeline.</p>
  
  <p><strong>original code (working)</strong></p>
  
  <pre><code>$(function () {
    (function () {
    var bgVid = new $.BigVideo({useFlashForFirefox: false})
    bgVid.show('http://videourl.com', { ambient : true });
    }();
  });
  </code></pre>
  
  <p>Next, I tried to set this equal variable so I could call it in the partial. Video started loading without using correct dimensions.</p>
  
  <pre><code>$(function () {
    var initVid = function () {
    var bgVid = new $.BigVideo({useFlashForFirefox: false})
    bgVid.show('http://videourl.com', { ambient : true });
    };
  </code></pre>
  
  <p>in partial:</p>
  
  <pre><code>$(function () {
    initVid();
  });
  </code></pre>
  
  <p>It looked like something was going on with the dom dimensions not fully loading, so I tried
  switching the function to something like this:</p>
  
  <p>in partial: </p>
  
  <pre><code>$(window).load(function () {
    var bgVid = new $.BigVideo({useFlashForFirefox: false});
    bgVid.show('http://videourl.com', { ambient : true });
  });
  </code></pre>
  
  <p>Still no luck.</p>
  
  <p>Finally, I resorted to using window.onload</p>
  
  <pre><code>window.onload = function () {
    var bgVid = new $.BigVideo({useFlashForFirefox: false})
    bgVid.show('http://videourl.com', { ambient : true });
  };
  </code></pre>
  
  <p>It works?! So why is $(window).load failing here while window.onload seems to be working fine? </p>