From: Jacob Thornton Date: Sat, 25 May 2013 07:16:52 +0000 (-0700) Subject: add data-ride=carousel support for starting carousel on load X-Git-Tag: v3.0.0-rc1~206^2~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7cbb1c0452a1d9904f7655aea78644def85b7f2e;p=thirdparty%2Fbootstrap.git add data-ride=carousel support for starting carousel on load --- diff --git a/js/carousel.js b/js/carousel.js index 628d72a12f..0da8e41cac 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);