title: Should I store $(document).height() and/or $(window).height() as variables?
body: <p>Is it a good idea to store these values as variables (outside of .scroll() ) in the following example?</p>
  
  <pre><code>$(window).scroll(function(){
    if ( $(document).height() &lt;= ( $(window).height() + $(window).scrollTop() ) ) {
      // position stuff
    } else {
      // other position stuff
    }
  });
  </code></pre>
  
  <p>The only downside to this I see is that the heights <em>should</em> be checked again in case of a window resize. Or do I only need to store the <strong>objects</strong> themselves?</p>
  
  <p>Any feedback is greatly appreciated!</p>