1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-06 13:46:42 +02:00

Carousel: refactor _slide method te accept only order as first argument

This commit is contained in:
GeoSot
2022-03-02 02:07:36 +02:00
committed by XhmikosR
parent fcc2c80976
commit 699402bee5
2 changed files with 19 additions and 26 deletions

View File

@@ -242,8 +242,8 @@ class Carousel extends BaseComponent {
}
const swipeConfig = {
leftCallback: () => this._slide(DIRECTION_LEFT),
rightCallback: () => this._slide(DIRECTION_RIGHT),
leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
endCallback: endCallBack
}
@@ -258,7 +258,7 @@ class Carousel extends BaseComponent {
const direction = KEY_TO_DIRECTION[event.key]
if (direction) {
event.preventDefault()
this._slide(direction)
this._slide(this._directionToOrder(direction))
}
}
@@ -301,9 +301,7 @@ class Carousel extends BaseComponent {
this._config.interval = elementInterval || this._config.defaultInterval
}
_slide(directionOrOrder, element) {
const order = this._directionToOrder(directionOrOrder)
_slide(order, element = null) {
const activeElement = this._getActive()
const activeElementIndex = this._getItemIndex(activeElement)