mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-24 20:02:53 +01:00
Carousel: make direct triggering of slid event, instead of using a callback
This commit is contained in:
parent
d97125475b
commit
928bdcadc5
@ -363,15 +363,6 @@ class Carousel extends BaseComponent {
|
||||
this._setActiveIndicatorElement(nextElement)
|
||||
this._activeElement = nextElement
|
||||
|
||||
const triggerSlidEvent = () => {
|
||||
EventHandler.trigger(this._element, EVENT_SLID, {
|
||||
relatedTarget: nextElement,
|
||||
direction: eventDirectionName,
|
||||
from: activeElementIndex,
|
||||
to: nextElementIndex
|
||||
})
|
||||
}
|
||||
|
||||
nextElement.classList.add(orderClassName)
|
||||
|
||||
reflow(nextElement)
|
||||
@ -387,7 +378,12 @@ class Carousel extends BaseComponent {
|
||||
|
||||
this._isSliding = false
|
||||
|
||||
setTimeout(triggerSlidEvent, 0)
|
||||
EventHandler.trigger(this._element, EVENT_SLID, {
|
||||
relatedTarget: nextElement,
|
||||
direction: eventDirectionName,
|
||||
from: activeElementIndex,
|
||||
to: nextElementIndex
|
||||
})
|
||||
}
|
||||
|
||||
this._queueCallback(completeCallBack, activeElement, this._isAnimated())
|
||||
|
Loading…
x
Reference in New Issue
Block a user