title: Scroll div until top of footer
body: <p>i've been looking for this for a couple of days but still no joy!</p>
  
  <p>I would like to have a div scroll in a fixed position until it gets to the top of the footer.</p>
  
  <p>Here is a fiddle of what i have so far: <a href="http://jsfiddle.net/danieljoseph/uk4mC/" rel="nofollow">http://jsfiddle.net/danieljoseph/uk4mC/</a></p>
  
  <p>I'm using this JQuery code but this uses pixels to determine when the div stops. I would like to use the top of the footer as the stop point:</p>
  
  <pre><code>$(document).scroll(function() {
  var scrollVal = $(document).scrollTop();
  $('#floating-container').css('top',scrollVal+'px');
  if (scrollVal &lt; 50) { 
      $('#floating-container').css('top','50px');
  }
  if (scrollVal &gt; 2347) {
      $('#floating-container').css('top','2347px');    
  }
  });
  </code></pre>
  
  <p>The issue is that i am using a CMS and the client will be adding text to the page so the second value will change depending on what they add.</p>
  
  <p>I hope i've been clear enough! please let me know if you require more details.</p>
  
  <p>Thanks,</p>