Reputation: 61
I have a slide of test with arrow for the next slide. I want go to next slide also with key(arrow). How can I this in Jquery?
Upvotes: 0
Views: 28
Reputation: 1084
You can use e.which to find the value of the key pressed. I believe e.which returns:
37 - left arrow
38 - up arrow
39 - right arrow
40 - down arrow
Simply check for whichever number e.which returns
$(function(){
$('html').keydown(function(e){
$('#keypress_con').text(e.which);
});
});
Here is a link to a JSFiddle that you can use as an example to catch arrow key press events:
Upvotes: 1