Make the side div follow after certain scroll
<p>Right now the div on the right follows the scroll all the time. If I want it to start following the scroll when the page is scrolled to the top of the div, and make it remain there when scrolled up, what more do I need to do?</p>

<p><a href="https://jsfiddle.net/4zreh4ek/2/" rel="nofollow">jsfiddle</a></p>

<pre><code>$(window).scroll(function(){
    var scrollTop = $(window).scrollTop();
        $('.mSidebar').css( "top", scrollTop + 400 );
    console.log(scrollTop);
});
</code></pre>