mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-20 17:54:23 +01:00
add data-ride=carousel support for starting carousel on load
This commit is contained in:
parent
e424b3879c
commit
7cbb1c0452
@ -186,7 +186,7 @@
|
|||||||
// =================
|
// =================
|
||||||
|
|
||||||
$(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) {
|
$(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 $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
|
||||||
var options = $.extend({}, $target.data(), $this.data())
|
var options = $.extend({}, $target.data(), $this.data())
|
||||||
var slideIndex
|
var slideIndex
|
||||||
@ -200,4 +200,11 @@
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
$(window).on('load', function () {
|
||||||
|
$('[data-ride="carousel"]').each(function () {
|
||||||
|
var $carousel = $(this)
|
||||||
|
$carousel.carousel($carousel.data())
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user