Skip to content

Keyboard navigation #183

serialbob opened this Issue Jun 23, 2011 · 4 comments

3 participants


If you add the keyboard navigation, the script will be perfect !



Yeah yeah! I second this motion. This is my favorite js gallery that I've ever used- all it lacks is a plugin for keyboard navigation.


This is how I achieved keyboard navigation in Slider 1.1.8. Looks like 2.0 will expose methods to trigger "next" and "previous", which would simplify the case statements down to one elegant line.

      $(document.documentElement).keyup( function(event) {
        var slides = $('#slides .pagination li'),
            current = slides.filter('.current');

        switch( event.keyCode ) {
          case 37: // Left arrow
            if ( slides.filter(':first').is( current ) ) {
            } else {
              slides.eq( slides.index(current) - 1 ).find('a').click();
          case 39: // Right arrow
            if ( slides.filter(':last').is( current ) ) {
            } else {
              current.find('+ li').filter(':first').find('a').click();

thanks fightingtheboss. i'm trying to learn js right now so this is doubly helpful


Thank you so mutch. I try now !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.