title: Using left and right arrow keys for additional navigation
body: <p>I want to add the ability for visitors to navigate between photo pages using their left and right arrow keys with cross-browser compatibility.</p>
  
  <p>My existing HTML already has Back and Next links. What do I need to do to get the left key to trigger &lt;%=previousLink%> and right key to trigger the &lt;%=nextLink%>?</p>
  
  <pre><code>&lt;div class="full-size-image-nav"&gt;
      &lt;%if previousNumber &lt;&gt; 0 then%&gt;
          &lt;div class="previous"&gt;
              &lt;p&gt;&lt;a href="&lt;%=previousLink%&gt;"&gt;Back&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
      &lt;%end if%&gt;
      &lt;%if nextNumber &lt;&gt; 0 then%&gt;
          &lt;div class="next"&gt;
              &lt;p&gt;&lt;a href="&lt;%=nextLink%&gt;"&gt;Next&lt;/a&gt;&lt;/p&gt;
          &lt;/div&gt;
      &lt;%end if%&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have seen <a href="https://stackoverflow.com/questions/302122/jquery-event-keypress-which-key-was-pressed">jQuery Event Keypress: Which key was pressed?</a>, but don't know how to adapt that to my code. Thank you.</p>