Skip to content

Commit

Permalink
check for data-interval on the first slide of carousel (twbs#31716)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellfyi committed Oct 2, 2020
1 parent c5966de commit 4b11b31
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/src/carousel.js
Original file line number Diff line number Diff line change
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
}
}

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

0 comments on commit 4b11b31

Please sign in to comment.