Keyboard Events For Viewing The Next And Previous For A Larger Images
I need Keyboard events for viewing the next and previous for a larger images. Please help me out. As I am viewing the images if am clicking on the mouse, like this I have to view t
Solution 1:
This should suit your needs, just slot it in, or if you need to use the left and right arrow keys elsewhere use $('#gallery')
instead of $(document)
$(document).keydown(function (e) {
if (event.keyCode == 37) {
$('#next').click(); //on left arrow, click next (since your next is on the left)
} elseif (event.keyCode == 39) {
$('#prev').click(); //on right arrow, click prev
}
});
EDIT: if you need any other keyCodes use this site: http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
Post a Comment for "Keyboard Events For Viewing The Next And Previous For A Larger Images"