title: How to animate div on scroll?
body: <p>Hi I can change and toggle the div attributes on scroll but when I use animate, it won't work but in weird manner.</p>
  
  <p>The following works:</p>
  
  <pre><code>$(document).scroll(function() {
  $("#register").css({left: $(this).scrollLeft() &gt; 1348? "-140px":"0px"});
  });
  </code></pre>
  
  <p>But this won't work:</p>
  
  <pre><code>$(document).scroll(function() {
  $("#register").animate({left: $(this).scrollLeft() &gt; 1348? "-140px":"0px"});
  });
  </code></pre>
  
  <p>I want the div to go away when I scroll more than 1348, and if the scroll is less than 1348, the div should appear again.</p>
  
  <p>Simple css works but animation doesn't work.</p>