Reputation: 6217
I'm trying to edit the Easy Slider to allow the keyboard's arrow keys to navigate the slideshow.
I tried editing the javascript's animate function from:
default:
t = dir;
break;
...to:
default:
t = parseInt(dir);
break;
...but that didn't work.
Does anyone know how to use the keyboard's arrow keys to navigate this slideshow?
Upvotes: 0
Views: 2166
Reputation: 26317
Assuming your next and prev links have IDs of #next and #prev:
$(document).keydown(function(e){
if (e.keyCode == 39) {
$('a#next').trigger('click');
}
else if (e.keyCode == 37) {
$('a#prev').trigger('click');
}
});
I'm also not familiar with easy slider, but if they have a way to programmatically switch the slides back and forth, then you could swap out the triggers with those. The posted solution will work fine though.
Upvotes: 4