title: jquery: animate scrollLeft
body: <p>I'm quite new to jquery and can't seem to figure out why my code isn't working. I have a horizontal layout and want to use the scrollLeft() function (which works perfect with this code)</p>
  
  <pre><code>$("#next").click(function() {
      currentElement = currentElement.next();
      scrollTo(currentElement);    
  });
  
  function scrollTo(element) {
      $(window).scrollLeft(element.position().left);
  }
  </code></pre>
  
  <p>But ideally, I would like to animate this so that when #next is clicked there is a nice animated effect to the scroll left function</p>
  
  <pre><code>$("#next").click(function() {
      currentElement = currentElement.next();
      scrollTo(currentElement);    
  });
  
  function scrollTo(element) {
      $(window).animate({scrollLeft: element.position().left}, 750);
  }
  </code></pre>
  
  <p>But to no avail. What am I doing wrong?</p>