Forked from dylanvalade/bootstrap-3-carousel-keyboard.js
Created
December 10, 2015 05:27
-
-
Save abhikhatri/eb3d3f4d383b71e6eeee to your computer and use it in GitHub Desktop.
Bootstrap carousel keyboard event controls for next and previous slides.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Register keyboard events | |
$(document).keydown(function(e) { | |
if (e.keyCode === 37) { | |
// Previous | |
$(".carousel-control.left").click(); | |
return false; | |
} | |
if (e.keyCode === 39) { | |
// Next | |
$(".carousel-control.right").click(); | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment