aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2013-05-25 00:16:52 -0700
committerJacob Thornton <[email protected]>2013-05-25 00:16:52 -0700
commit7cbb1c0452a1d9904f7655aea78644def85b7f2e (patch)
treed05c1e56a38bff5d165a9c5cb1ddbd603d06707a
parente424b3879c751a8c0efc20d549ee066c8b1f9068 (diff)
downloadbootstrap-7cbb1c0452a1d9904f7655aea78644def85b7f2e.tar.xz
bootstrap-7cbb1c0452a1d9904f7655aea78644def85b7f2e.zip
add data-ride=carousel support for starting carousel on load
-rw-r--r--js/carousel.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/js/carousel.js b/js/carousel.js
index 628d72a12..0da8e41ca 100644
--- a/js/carousel.js
+++ b/js/carousel.js
@@ -186,7 +186,7 @@
// =================
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
- var $this = $(this), href
+ var $this = $(this), href
var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
var options = $.extend({}, $target.data(), $this.data())
var slideIndex
@@ -200,4 +200,11 @@
e.preventDefault()
})
+ $(window).on('load', function () {
+ $('[data-ride="carousel"]').each(function () {
+ var $carousel = $(this)
+ $carousel.carousel($carousel.data())
+ })
+ })
+
}(window.jQuery);