title: jQuery scrolling issues with scrollTop
body: <p>I am having 2 issues with scrolling, i figured it would just be easier to ask them both in one post. </p>
  
  <p>Before I ask, below is my jQuery code im having issues with.</p>
  
  <pre><code>$("a").click(function() {
      if(this.hash){
          $("#main").animate({
              scrollTop : $("h3[name="+this.hash.substr(1)+"]").position().top - 120
          },2000,"easeOutExpo");
      }
  });
  </code></pre>
  
  <p>Situation: What I have going on in my page is basically i have a side menu with a couple lists. Each item in each list links to a anchor in my main div section, or my 'content' section. When a list item is clicked, the code above runs and it scrolls to one of the anchors.</p>
  
  <p>Issue 1: When i click on a item in one of the lists, it scrolls down to a anchor which works just fine. But when that same item is clicked again, the main area scrolls back up to the top of the div. My thought to fix this was to check the current 'scrolled to' location of the div, and then not allow the code to run again if the location hadn't changed since the first click but i couldn't get that to work. Any suggestions on how to fix this issue?</p>
  
  <p>Issue 2: Again as stated above, when i click on a item in a list it scrolls down to a anchor. What i then want to be able to to is click on a different list item and have it scroll to that position. The problem is when i click on a different list item, it scrolls to some random position in the main div, positions i haven't even anchored yet. Can anyone explain how I can make it so i can scroll from anchor to anchor?</p>
  
  <p>Note: Please respond by having issue 1 or issue 2 above your explanation so i know which one your referring to. Thanks </p>
  
  <p><strong>EDIT:</strong> Thanks to Roko's help i got it working. For future viewers here is the fiddle of a working demo: <a href="http://jsfiddle.net/TsUcc/3/" rel="nofollow">http://jsfiddle.net/TsUcc/3/</a> and below is what the finally jquery code looks like</p>
  
  <pre><code>$("a").click(function( e ) {
      e.preventDefault();
  
      if(this.hash){
  
          var target = '#'+ this.hash.substr(1);
          var destination = $(target).offset().top - 10;
  
          $('#main').stop().animate({
              scrollTop : '+=' + destination
          }, 1000);
      }
  });
  </code></pre>