SerialScroll_use-the-arrows.js 873 B

12345678910111213141516171819202122232425262728293031323334
  1. /*******************************************
  2. Snippet for jQuery.SerialScroll
  3. --Manipulate SerialScroll with the keyboard--
  4. Note that this also applies to the mouse,
  5. just trigger prev or next whenever you want
  6. *********************************************/
  7. jQuery(function( $ ){
  8. var $pane = $('#pane');//let's save it, the element being scrolled
  9. $pane.serialScroll({
  10. //...
  11. });
  12. $(document).keyup(function(e){
  13. switch( e.keyCode ){
  14. case 39://right (->)
  15. $pane.trigger('next');
  16. break;
  17. case 37://left (<-)
  18. $pane.trigger('prev');
  19. break;
  20. }
  21. });
  22. });
  23. /***********************************************
  24. If you want to use up and down:
  25. - use 38(up), and 40(down).
  26. To see other keyCodes, check: http://rurl.org/pdl
  27. *************************************************/