title: Changing div postion depending on page scroll
body: <p>I have the following code below that changes a div's position to fixed once an element scrollTop is greater than a number. I am trying to either amend this script or find a different solution so that the div will scroll between a range and STOP scrolling at some point ( so the div doesn't go off the page or overlap with footer elements.</p>
  
  <p>I don't know if the right way is to say that IF scrollTop is greater than 150 then position=fixed, and if it's greater than 600 then position goes back to absolute, or if there's a better way, like distance from the bottom... </p>
  
  <p>AND I use MooTools, not jQuery. I know there are a few jQuery options / plugins that do this. Thanks in advance! </p>
  
  <pre><code>window.onscroll = function()
  {
      if( window.XMLHttpRequest ) { // IE 6 doesnt implement position fixed nicely...     
          if (document.documentElement.scrollTop &gt; 150) {
              $('tabber').style.position = 'fixed';
              $('tabber').style.top = '0';
  
          } else {
  
              $('tabber').style.position = 'absolute'; 
              $('tabber').style.top = 'auto';
  
  
          }
      }
  }
  </code></pre>