title: Scrolling down to next element via keypress & scrollTo plugin - jQuery
body: <p>I am using jQuery's <a href="http://flesler.blogspot.com/2007/10/jqueryscrollto.html" rel="nofollow noreferrer">scrollTo</a> plugin to scroll up and down my page, using UP arrow and DOWN arrow.</p>
  
  <p>i have a bunch of div with class "screen", as so: <code>&lt;div class="screen-wrapper"&gt;...&lt;/div&gt;</code></p>
  
  <p>What I am trying to do is, when i press UP or DOWN, the window scrolls to the next, or previous div with class of "screen".</p>
  
  <p>I have the keypresses taken care of.
  According to the plugin docs, to scroll a window, you use $.scrollTo(...);</p>
  
  <p>Here's the code I have:</p>
  
  <pre><code>$(document).keypress(function(e){
      switch (e.keyCode) {
          case 40:    // down
              n = $('.screen-wrapper').next()
              $.scrollTo( n, 800 );
            break;
          case 38:    // up
  
            break;
          case 37:    // left
  
            break;
          case 39:    // right
  
            break;
  
      }      
  });
  </code></pre>
  
  <p>And if it helps, here's the HTML div. I have a few of these on the page, and essentially, am trying to scroll to next one by pressing down arrow:</p>
  
  <pre><code>&lt;div class='screen-wrapper'&gt;
  &lt;div class='screen'&gt;
      &lt;div class="sections"&gt;
          &lt;ul&gt;
              &lt;li&gt;&lt;img src="images/portfolio/sushii-1.png " /&gt;&lt;/li&gt;
              &lt;li&gt;&lt;img src="images/portfolio/sushii-2.png" /&gt;&lt;/li&gt;
              &lt;li&gt;&lt;img src="images/portfolio/sushii-3.png" /&gt;&lt;/li&gt;
          &lt;/ul&gt;
      &lt;/div&gt;
  
      &lt;div class="next"&gt;&lt;/div&gt;
      &lt;div class="prev"&gt;&lt;/div&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>And also if it needed, I can provide a link where this is being used if it'll  help someone get a better idea.
      </p>
  
  <p><strong>edit</strong>
  And, i forgot to mention what the real question here is.
  The question/problem is that it won't scroll down past the first element, as <em>seth</em> mentioned.</p>