diff options
| author | Mark Otto <[email protected]> | 2016-07-23 21:05:18 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2016-07-23 21:05:18 -0700 |
| commit | 7fd00263e35f891bfc792f9dd12c17a5025cd93c (patch) | |
| tree | 28d07418fb7abfacccb317b501937e02ffccf096 /js/src/carousel.js | |
| parent | d4457b33032d2540a4a3b7fa600f22055ce2000d (diff) | |
| parent | 38312640df9c4b84a47e62d7dfeb16b25049aafb (diff) | |
| download | bootstrap-7fd00263e35f891bfc792f9dd12c17a5025cd93c.tar.xz bootstrap-7fd00263e35f891bfc792f9dd12c17a5025cd93c.zip | |
Merge branch 'v4-dev' into v4-navbars
Diffstat (limited to 'js/src/carousel.js')
| -rw-r--r-- | js/src/carousel.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index 34cab4391..e24aed08f 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -24,6 +24,8 @@ const Carousel = (($) => { const DATA_API_KEY = '.data-api' const JQUERY_NO_CONFLICT = $.fn[NAME] const TRANSITION_DURATION = 600 + const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key + const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key const Default = { interval : 5000, @@ -236,9 +238,14 @@ const Carousel = (($) => { } switch (event.which) { - case 37: this.prev(); break - case 39: this.next(); break - default: return + case ARROW_LEFT_KEYCODE: + this.prev() + break + case ARROW_RIGHT_KEYCODE: + this.next() + break + default: + return } } |
