Is there a way to control a slider with the keyboard arrow keys and not just clicking on the buttons on screen?

Is there a way to control a slider with the keyboard arrow keys and not just clicking on the buttons on screen?

2 Likes

I’ve also wandered about this… Likewise arrow key navigation to sections?

2 Likes

Also like to know … someone ??

1 Like

Hey lets reignite this conversation!

The initial question received 250+ views it seems as if its on peoples mind!

And not only that, I feel as if using the arrow keys to go through sliders for say photographer sites or any slide of that matter should be an innate function when navigating sliders.

I wonder why this hasn’t been answered and/or why it isn’t just built within the sliders already.

1 Like

Inserting this into the Code Section on the page with the Slider works for me so far…
Jim

<script>
var Webflow = Webflow || [];
Webflow.push(function () {

$(document).keydown(function(e) {
    switch(e.which) {
        case 37: // left
          $('.w-slider-arrow-left').trigger('tap');
          break;
        case 38: // up
          break;
        case 39: // right
          $('.w-slider-arrow-right').trigger('tap');
          break;
        case 40: // down
          break;
        default: return; // exit this handler for other keys
    }
    e.preventDefault(); // prevent the default action (scroll / move caret)
});
});

</script>
7 Likes