title: Setting global variables and wrap in $(window).load
body: <p>I'm trying to set some Js variables that calculate some heights and offsets, but I need to do that after the page loads b/c I've got 3rd party ads loading and shifting things around. </p>
  
  <p>So the issue: </p>
  
  <p>What I've got is: </p>
  
  <pre><code>var sidebarHeight = $('.sidebar').height(),
      sidebarOffset = $('.sidebar').offset().top;
  </code></pre>
  
  <p>But those won't be set right unless I get them like this:</p>
  
  <pre><code>$(window).on('load', function(){
      var sidebarHeight = $('.sidebar').height(),
          sidebarOffset = $('.sidebar').offset().top;
  });
  </code></pre>
  
  <p>But the problem then is that those variables aren't global - they're local to that function and hence aren't reusable by other functions.</p>
  
  <p><strong>So the question then</strong>:   How can I set it up so these variables are set on window.load, but are still global and useable by other functions? </p>