diff --git a/js/src/carousel.js b/js/src/carousel.js index 5a9b2dc84627..7a30beb10e3d 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -59,7 +59,6 @@ const SELECTOR_ACTIVE = '.active' const SELECTOR_ITEM = '.carousel-item' const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM const SELECTOR_ITEM_IMG = '.carousel-item img' -const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev' const SELECTOR_INDICATORS = '.carousel-indicators' const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]' const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]' @@ -142,7 +141,7 @@ class Carousel extends BaseComponent { this._stayPaused = true } - if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { + if (this._isSliding) { triggerTransitionEnd(this._element) this.cycle(true) } diff --git a/js/tests/unit/carousel.spec.js b/js/tests/unit/carousel.spec.js index 9817b83f1c6e..8875f3f00382 100644 --- a/js/tests/unit/carousel.spec.js +++ b/js/tests/unit/carousel.spec.js @@ -868,7 +868,7 @@ describe('Carousel', () => { }) describe('pause', () => { - it('should call cycle if the carousel have carousel-item-next and carousel-item-prev class', () => { + it('should call cycle if the carousel have carousel-item-next or carousel-item-prev class, cause is sliding', () => { fixtureEl.innerHTML = [ '