mirror of
https://github.com/twbs/bootstrap.git
synced 2025-09-26 21:39:08 +02:00
Use named constants for magic numbers (#19992)
Mostly KeyboardEvent.which and MouseEvent.which values. [skip validator]
This commit is contained in:
@@ -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,8 +238,8 @@ const Carousel = (($) => {
|
||||
}
|
||||
|
||||
switch (event.which) {
|
||||
case 37: this.prev(); break
|
||||
case 39: this.next(); break
|
||||
case ARROW_LEFT_KEYCODE: this.prev(); break
|
||||
case ARROW_RIGHT_KEYCODE: this.next(); break
|
||||
default: return
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user