]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
add data-ride=carousel support for starting carousel on load
authorJacob Thornton <jacobthornton@gmail.com>
Sat, 25 May 2013 07:16:52 +0000 (00:16 -0700)
committerJacob Thornton <jacobthornton@gmail.com>
Sat, 25 May 2013 07:16:52 +0000 (00:16 -0700)
js/carousel.js

index 628d72a12fe4dee15c7bcbee75c37135c9f33032..0da8e41cac21985eae7ab40bc14fe2671beac669 100644 (file)
   // =================
 
   $(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
     e.preventDefault()
   })
 
+  $(window).on('load', function () {
+    $('[data-ride="carousel"]').each(function () {
+      var $carousel = $(this)
+      $carousel.carousel($carousel.data())
+    })
+  })
+
 }(window.jQuery);