Bottom out fixed floating sidebar
<p>ive been using this fixed floating sidebar courtesy of (http://jqueryfordesigners.com/fixed-floating-elements/). This works great, my only problem is that I dont know how to force a bottom out so the fixed positioning will never be taller than the viewable area. My sidebar has the ability to add content and sometimes when there is a lot of content the sidebar extends off the page at the bottom. Can someone shoot me in the right direction? Here is the javascript for the sidebar.</p>

<pre><code>  var msie6 = $.browser == 'msie' &amp;&amp; $.browser.version &lt; 7;

  if (!msie6) {
    var top = $('#comment').offset().top - parseFloat($('#comment').css('margin-top').replace(/auto/, 0));
    $(window).scroll(function (event) {
  // what the y position of the scroll is
  var y = $(this).scrollTop();

  // whether that's below the form
  if (y &gt;= top) {
    // if so, ad the fixed class
    $('#comment').addClass('fixed');
  } else {
    // otherwise remove it
    $('#comment').removeClass('fixed');
  }
});
</code></pre>

<p>}<br>
});</p>
