aboutsummaryrefslogtreecommitdiff
path: root/js/src/carousel.js
diff options
context:
space:
mode:
authorPierre-Denis Vanduynslager <[email protected]>2016-08-02 01:35:38 -0400
committerPierre-Denis Vanduynslager <[email protected]>2016-08-02 01:35:38 -0400
commit27cf3d675c80029ff2cea1e14903886c00119e37 (patch)
treea84ac3a7f6759fe0be4f099c41e6c92b58999437 /js/src/carousel.js
parentf0c0a7533c854613eba42394631567a44d790053 (diff)
parent8e4f3fe7b95f6bb7c9939288229ec5683364743d (diff)
downloadbootstrap-27cf3d675c80029ff2cea1e14903886c00119e37.tar.xz
bootstrap-27cf3d675c80029ff2cea1e14903886c00119e37.zip
Merge remote-tracking branch 'twbs/v4-dev' into v4-dev
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r--js/src/carousel.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index 34cab4391..e2a6537bf 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -3,7 +3,7 @@ import Util from './util'
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.0.0-alpha.2): carousel.js
+ * Bootstrap (v4.0.0-alpha.3): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -18,12 +18,14 @@ const Carousel = (($) => {
*/
const NAME = 'carousel'
- const VERSION = '4.0.0-alpha.2'
+ const VERSION = '4.0.0-alpha.3'
const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}`
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
}
}