title: Jquery scroll navigation can't detect current section
body: <p>I made a page that contains several divs with class content</p>
  
  <pre><code>&lt;div class="content" id="content-0"&gt;content 1&lt;/div&gt;
  &lt;div class="content" id="content-1"&gt;content 2&lt;/div&gt;
  &lt;div class="content" id="content-2"&gt;content 3&lt;/div&gt;
  &lt;div class="content" id="content-3"&gt;content 4&lt;/div&gt;
  &lt;div class="content" id="content-4"&gt;content 5&lt;/div&gt;
  </code></pre>
  
  <p>I also made 2 links that switch between next and previous div</p>
  
  <pre><code>&lt;div class="nav"&gt;
      &lt;a id="prev" href="#"&gt;previous&lt;/a&gt;
      &lt;a id="next" href="#"&gt;next&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I used TwinMax and ScrollTo plugins to make navigate between the divs</p>
  
  <pre><code>var section = 0;
      var number = $('.content').length;
          $("#next").click(function(e){
            e.preventDefault();
  
            if(section &lt; number){
              section++;
            }
            TweenMax.to(window, 0.5, {scrollTo:{y:$("#content-" +    section).offset().top}});
          });
  
          $("#prev").click(function(e){
            e.preventDefault();
            if(section &gt; 0){
              section--;
              TweenMax.to(window, 0.5, {scrollTo:{y:$("#content-" + section).offset().top}});
            }
  
          }); 
  </code></pre>
  
  <p>Here is  a<a href="http://jsfiddle.net/1thp1r6h/27/" rel="nofollow">JSFiddle</a>.</p>
  
  <p>The problem is this:</p>
  
  <p>When I scroll with the mouse to the last section and then click the next buttom , the page scrolls back to the second section .</p>
  
  <p>How do I detect the current div so the next button goes to the next div correctly?</p>