From 4b11b31226ab3cdb9f0f644e9cde808942c2783c Mon Sep 17 00:00:00 2001 From: Mitchell Bryson Date: Fri, 2 Oct 2020 09:49:07 +0100 Subject: [PATCH] check for data-interval on the first slide of carousel (#31716) --- js/src/carousel.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/src/carousel.js b/js/src/carousel.js index bd5f3d20403b..5e6bfb31e319 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -181,6 +181,16 @@ class Carousel { } if (this._config && this._config.interval && !this._isPaused) { + this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element) + + if (this._activeElement) { + const activeElementInterval = parseInt(this._activeElement.getAttribute('data-interval'), 10) + + if (activeElementInterval) { + this._config.interval = activeElementInterval + } + } + this._interval = setInterval( (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval