Keyboard arrow keys navigation with Easy Slider 1.7
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:
开发者_C百科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?
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.
精彩评论