jQuery Scroll without infinite loop
<p>I created a simple page with content and a sidebar. When the user scrolls, the sidebar goes down. When the sidebar is small it works right, but when the sidebar is large it gets down infinitely.</p>

<p>I created a demo page for better explanation.</p>

<p>In this first example, the sidebar is small so it works correct (<a href="http://jsbin.com/ojasuj/2/" rel="nofollow">http://jsbin.com/ojasuj/2/</a>)</p>

<p>In this second example, the sidebar is large then it goes infinitely down (<a href="http://jsbin.com/ojasuj/" rel="nofollow">http://jsbin.com/ojasuj/</a>).</p>

<p>I want to stop the animation at the bottom. I am using this javascript:</p>

<pre><code>jQuery.noConflict();

jQuery(document).ready(function() {
    jQuery( document ).scroll( function() {
        if( jQuery(document).scrollTop() &lt;= ( jQuery(document).height() - jQuery(window).height() ) ) {
            jQuery(".sidebar").stop().animate({"marginTop": ( jQuery(document).scrollTop() + 10 ) + "px"}, "slow" );
        } else {
            jQuery(".sidebar").css({'margin-bottom': '100px'});
        }
    });
});
</code></pre>

<p>I tried several ways but could not solve this problem. I tried to use some scripts, but they also did not work. I hope someone can help me.</p>
