diff options
Diffstat (limited to 'js/src')
| -rw-r--r-- | js/src/carousel.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index d8da854a2..8d47fbf9b 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -119,6 +119,13 @@ const Carousel = (($) => { } } + nextWhenVisible() { + // Don't call next when the page isn't visible + if (!document.hidden) { + this.next() + } + } + prev() { if (!this._isSliding) { this._slide(Direction.PREVIOUS) @@ -152,7 +159,7 @@ const Carousel = (($) => { if (this._config.interval && !this._isPaused) { this._interval = setInterval( - $.proxy(this.next, this), this._config.interval + $.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval ) } } |
