Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for data-interval on the first slide of carousel #31818

Merged
merged 14 commits into from Nov 1, 2020
10 changes: 10 additions & 0 deletions js/src/carousel.js
Expand Up @@ -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
}
}
Johann-S marked this conversation as resolved.
Show resolved Hide resolved

this._interval = setInterval(
(document.visibilityState ? this.nextWhenVisible : this.next).bind(this),
this._config.interval
Expand Down