mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-03-22 15:30:23 +00:00
Carousel: make direct triggering of slid event, instead of using a callback
This commit is contained in:
parent
d97125475b
commit
928bdcadc5
1 changed files with 6 additions and 10 deletions
|
|
@ -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…
Reference in a new issue