diff options
author | Tanguy Krotoff <tkrotoff@gmail.com> | 2020-04-15 17:52:18 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2020-04-17 18:22:15 +0300 |
commit | dcd99aa7d1cb8018a1378bc75053853e07edbfff (patch) | |
tree | 7cf92cdba5a9d0dc1b04a7b90055bfcdaaeecb21 /js/src/carousel.js | |
parent | 8547ab149a9406937c0ec4f0c7864a8884b63d64 (diff) |
Replace event.which with event.key and event.button
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r-- | js/src/carousel.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index a5451538cd..93f896e535 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -33,8 +33,8 @@ const DATA_KEY = 'bs.carousel' const EVENT_KEY = `.${DATA_KEY}` const DATA_API_KEY = '.data-api' -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 ARROW_LEFT_KEY = 'ArrowLeft' +const ARROW_RIGHT_KEY = 'ArrowRight' const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch const SWIPE_THRESHOLD = 40 @@ -342,12 +342,12 @@ class Carousel { return } - switch (event.which) { - case ARROW_LEFT_KEYCODE: + switch (event.key) { + case ARROW_LEFT_KEY: event.preventDefault() this.prev() break - case ARROW_RIGHT_KEYCODE: + case ARROW_RIGHT_KEY: event.preventDefault() this.next() break |