diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2015-10-18 20:58:40 +0300 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2015-10-18 20:58:40 +0300 |
commit | a83988ed4257ffd83f5734868efb6cf9b1ca3296 (patch) | |
tree | c3523256cb7835576f420e0c0604da1fa25a370f /assets/javascripts/bootstrap | |
parent | 357ce5cb41b4d6a5dabe76e294e29380c47c7783 (diff) |
rake update[v4-dev]
Diffstat (limited to 'assets/javascripts/bootstrap')
-rw-r--r-- | assets/javascripts/bootstrap/carousel.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/assets/javascripts/bootstrap/carousel.js b/assets/javascripts/bootstrap/carousel.js index 880ac45..ea99cad 100644 --- a/assets/javascripts/bootstrap/carousel.js +++ b/assets/javascripts/bootstrap/carousel.js @@ -120,6 +120,14 @@ var Carousel = (function ($) { } } }, { + key: 'nextWhenVisible', + value: function nextWhenVisible() { + // Don't call next when the page isn't visible + if (!document.hidden) { + this.next(); + } + } + }, { key: 'prev', value: function prev() { if (!this._isSliding) { @@ -154,7 +162,7 @@ var Carousel = (function ($) { } if (this._config.interval && !this._isPaused) { - this._interval = setInterval($.proxy(this.next, this), this._config.interval); + this._interval = setInterval($.proxy(document.visibilityState ? this.nextWhenVisible : this.next, this), this._config.interval); } } }, { |