使用Easy Slider 1.7的键盘箭头键导航 [英] Keyboard arrow keys navigation with Easy Slider 1.7
问题描述
我正在尝试编辑 Easy Slider 允许键盘的箭头键浏览幻灯片.
I'm trying to edit the Easy Slider to allow the keyboard's arrow keys to navigate the slideshow.
我尝试通过以下方式编辑 javascript的动画函数: /p>
I tried editing the javascript's animate function from:
default:
t = dir;
break;
...发送至:
default:
t = parseInt(dir);
break;
...但是那没用.
有人知道如何使用键盘的箭头键浏览此幻灯片吗?
Does anyone know how to use the keyboard's arrow keys to navigate this slideshow?
推荐答案
假设您的下一个和上一个链接的ID为#next和#prev:
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.
这篇关于使用Easy Slider 1.7的键盘箭头键导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!