Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'assets/javascripts/bootstrap/carousel.js')
-rw-r--r--assets/javascripts/bootstrap/carousel.js10
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);
}
}
}, {