title: jQuery - DIV to move with scrolling motion and stick position to top and bottom  of window
body: <p>There may be already a jQuery plugin which can achieve this, but I can't find one to do exactly what I'm after. If there is, just point me to the tutorial, thanks.</p>
  
  <p>My problem I have is that I have very long page content, and my sidebar is not visible when you are scrolled near the bottom of the page.</p>
  
  <p>So I would like to make my #sidebar div to stick to the top and bottom of my browser window as you scroll up and down the page.</p>
  
  <p>My sidebar height is longer than your typical screen resolution, so I need the bottom of sidebar to sticky to the bottom of the browser window as well as the top of the browser.</p>
  
  <p>So as you begin to scroll down, the side bar will scroll like normal, but when you reach the end the sidebar, it sticks and will not scroll, and as you begin to scroll up, the sidebar will follow until the top of sidebar reaches the browser, then it sticks. Vice Versa.</p>
  
  <p>Is this possible?</p>
  
  <p>I have created a <a href="http://jsfiddle.net/motocomdigital/7ey9g/5/">jsfiddle</a> of simple design layout which is central. I have added a dotted border to the sidebar so you now where the sidebar should stick.</p>
  
  <p><a href="http://jsfiddle.net/motocomdigital/7ey9g/5/">http://jsfiddle.net/motocomdigital/7ey9g/5/</a></p>
  
  <p>Any advice, or you know a online tutorial or demo, would most awesome!
  <br /><br /></p>
  
  <hr />
  
  <p><strong>UPDATE</strong></p>
  
  <p>Please see this attempt by @Darek Rossman</p>
  
  <p><a href="http://jsfiddle.net/dKDJz/4/">http://jsfiddle.net/dKDJz/4/</a></p>
  
  <p>He's got the basic idea working. But the scrolling up, causes it to snap to the top. I need the sidebar to be fluid with the scrolling up/down motion. But sticking to the either the top or bottom of the window. It should also not be fixed positioned when the header/footer are in viewport, so it does not overlay.</p>
  
  <p>Thanks</p>