mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-18 10:52:19 +01:00
carousel: switch to if/else
(#32395)
There are only two conditions, so `if/else` is shorter and has the same effect.
This commit is contained in:
parent
8fed098ef9
commit
6f9c38f65e
@ -340,16 +340,12 @@ class Carousel extends BaseComponent {
|
||||
return
|
||||
}
|
||||
|
||||
switch (event.key) {
|
||||
case ARROW_LEFT_KEY:
|
||||
event.preventDefault()
|
||||
this.prev()
|
||||
break
|
||||
case ARROW_RIGHT_KEY:
|
||||
event.preventDefault()
|
||||
this.next()
|
||||
break
|
||||
default:
|
||||
if (event.key === ARROW_LEFT_KEY) {
|
||||
event.preventDefault()
|
||||
this.prev()
|
||||
} else if (event.key === ARROW_RIGHT_KEY) {
|
||||
event.preventDefault()
|
||||
this.next()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user