title: Animate does not work properly on scroll
body: <p>I have found this script and would be great but if I scroll to the top all browsers wait around 10 secs to animate back. 
  This script animate if you scroll down or up. Down way works fine bet the up way does not.
  I do not know what can be the problem. I tried to leave only one animation but the same result.</p>
  
  <p>Thanks</p>
  
  <pre><code>$(function () {
  
    var iScrollPos = 0;
    var header = $('header');
    var li = $('.headerRight nav ul li');
    var logo = $('h2');
  
    $(window).scroll(function () {
        var iCurScrollPos = $(this).scrollTop();
        if (iCurScrollPos &gt; iScrollPos) {
          header.animate({
            top: '-3.5em'
          }, 250);
  
          li.animate({
            padding: '0'
          }, 250);
  
          logo.animate({
            fontSize: '1.5em'
          }, 250);
        }
        else {
          header.animate({
            top: '0em'
          }, 250);
  
          li.animate({
            padding: '1em'
          }, 250);
  
          logo.animate({
            fontSize: '2em'
          }, 250);
        }
    });
  });
  </code></pre>