Navigate the images with the arrow keys on the keyboard with jquery [closed]
开发者_JAVA百科I have a div divided into two lines, built dynamically, that I have a query that returns me the images if they are over 13 becomes the span of two righe.E 'can be an example to browse these images with the arrow keys on the keyboard, going in any direction with jquery?
Your question is a little unclear - you may want to edit it :)
To navigate with the arrow keys you can add a keydown event listener to the document:
$(document).bind('keydown.gallery', function(e) {
if (e.keyCode == 37) {
e.preventDefault();
// Do left arrow stuff
} else if (e.keyCode == 39) {
e.preventDefault();
// Do right arrow stuff
}
});
精彩评论