Streaming live at 10am (PST)

Use Arrow Key to Change Slides

For anyone looking to use the arrow keys to change slides.

 <script>
      
      	$(document).on('keyup', function(event) {
		if (event.which === 37) { 
          	$(' .w-slider-arrow-left').trigger('tap');
        	} 
      	else if (event.which === 39) { 
          	$('.w-slider-arrow-right').trigger('tap');
        	} 
        });
      
  </script>

All key codes can be found here

4 Likes

Pretty neat. I love it when they’re are multiple ways of navigating the components!

// NAVIGATE WITH KEYS
$(document).keydown(function(e) {
  switch (e.which) {
    case 37: // key arrow left
      var href = $('#previous_button').attr('href');
      window.location.href = href;
      break;

    case 39: // key arrow right
      var href = $('#next_button').attr('href');
      window.location.href = href;
      break;
  }
  e.preventDefault(); 
});