aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2013-08-11 15:41:06 -0700
committerJacob Thornton <[email protected]>2013-08-11 15:41:06 -0700
commit92c2ad98e753c64a2bd6e3fb94870a2ad3ee0333 (patch)
tree322422a541597049642483dde3de8d5ed5bbbb38 /js
parentb8ed111a18deaa766862f9bb0a5dd340a3d02675 (diff)
downloadbootstrap-92c2ad98e753c64a2bd6e3fb94870a2ad3ee0333.tar.xz
bootstrap-92c2ad98e753c64a2bd6e3fb94870a2ad3ee0333.zip
fixes #8983
Diffstat (limited to 'js')
-rw-r--r--js/carousel.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/js/carousel.js b/js/carousel.js
index d4bcb88b7..d8c4c243c 100644
--- a/js/carousel.js
+++ b/js/carousel.js
@@ -41,6 +41,7 @@
Carousel.DEFAULTS = {
interval: 5000
, pause: 'hover'
+ , wrap: true
}
Carousel.prototype.cycle = function (e) {
@@ -105,12 +106,15 @@
var fallback = type == 'next' ? 'first' : 'last'
var that = this
+ if (!$next.length) {
+ if (!this.options.wrap) return
+ $next = this.$element.find('.item')[fallback]()
+ }
+
this.sliding = true
isCycling && this.pause()
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
-
var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction })
if ($next.hasClass('active')) return