mirror of https://github.com/twbs/bootstrap.git
Carousel: change argument to `_setActiveIndicatorElement`, from element to index
This commit is contained in:
parent
928bdcadc5
commit
d52f6c9de1
|
@ -291,7 +291,7 @@ class Carousel extends BaseComponent {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
_setActiveIndicatorElement(element) {
|
_setActiveIndicatorElement(index) {
|
||||||
if (!this._indicatorsElement) {
|
if (!this._indicatorsElement) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ class Carousel extends BaseComponent {
|
||||||
activeIndicator.classList.remove(CLASS_NAME_ACTIVE)
|
activeIndicator.classList.remove(CLASS_NAME_ACTIVE)
|
||||||
activeIndicator.removeAttribute('aria-current')
|
activeIndicator.removeAttribute('aria-current')
|
||||||
|
|
||||||
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${this._getItemIndex(element)}"]`, this._indicatorsElement)
|
const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement)
|
||||||
|
|
||||||
if (newActiveIndicator) {
|
if (newActiveIndicator) {
|
||||||
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)
|
newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)
|
||||||
|
@ -360,7 +360,7 @@ class Carousel extends BaseComponent {
|
||||||
this.pause()
|
this.pause()
|
||||||
}
|
}
|
||||||
|
|
||||||
this._setActiveIndicatorElement(nextElement)
|
this._setActiveIndicatorElement(nextElementIndex)
|
||||||
this._activeElement = nextElement
|
this._activeElement = nextElement
|
||||||
|
|
||||||
nextElement.classList.add(orderClassName)
|
nextElement.classList.add(orderClassName)
|
||||||
|
|
Loading…
Reference in New Issue