aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeoSot <[email protected]>2022-01-31 00:31:07 +0200
committerXhmikosR <[email protected]>2022-02-19 14:52:36 +0200
commit928bdcadc56cef30b4483616c4b2eee7cfa34bd2 (patch)
tree1237c17f42ec7fd1b02b83fe01169b51fe49ec43
parentd97125475b3a5cbbafe3100d5981fd456c92c722 (diff)
downloadbootstrap-928bdcadc56cef30b4483616c4b2eee7cfa34bd2.tar.xz
bootstrap-928bdcadc56cef30b4483616c4b2eee7cfa34bd2.zip
Carousel: make direct triggering of slid event, instead of using a callback
-rw-r--r--js/src/carousel.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index 00d930495..b8d921e42 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -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())