Hello, I've made a slider that uses the left and right arrow keys to move the slide but when pressed to quickly it will bug a little and I was wondering if it's possible to limit the amount of presses in say a second. You can see it here: [link removed]
$('#slider-nav div').click(function() {
$('#slider-nav div').removeClass('selected').addClass('');
$('#slider-nav div:eq('+($.jcarousel.intval($(this).text())-1)+')').addClass('selected');
})
// Allow left and right keys to control slider
$(document.documentElement).keypress(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
var direction = null;
// handle cursor keys
if (code == 37) { // left key
direction = 'prev';
}
else if (code == 39) { // right key
direction = 'next';
}
if (direction != null) {
$('#slider-nav div.selected')[direction]().click();
}
});