diff options
author | fat <jacobthornton@gmail.com> | 2012-12-22 07:45:19 +0400 |
---|---|---|
committer | fat <jacobthornton@gmail.com> | 2012-12-22 07:45:19 +0400 |
commit | 24a36df9f6afa27de0dcc44799c9ab428969d8ca (patch) | |
tree | 84b08b90c35ac5b0ad534487afdf1dd7b5c1d417 /docs/assets/js/bootstrap-carousel.js | |
parent | 818c56f078ff3b14fefceca77608d1e95f33a783 (diff) |
add support for [data-slide-to] attr on carousel
Diffstat (limited to 'docs/assets/js/bootstrap-carousel.js')
-rw-r--r-- | docs/assets/js/bootstrap-carousel.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/docs/assets/js/bootstrap-carousel.js b/docs/assets/js/bootstrap-carousel.js index dbea837116..c73da092af 100644 --- a/docs/assets/js/bootstrap-carousel.js +++ b/docs/assets/js/bootstrap-carousel.js @@ -188,11 +188,18 @@ /* CAROUSEL DATA-API * ================= */ - $(document).on('click.carousel.data-api', '[data-slide]', function (e) { + $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { var $this = $(this), href , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 , options = $.extend({}, $target.data(), $this.data()) + , slideIndex + $target.carousel(options) + + if (slideIndex = $this.attr('data-slide-to')) { + $target.data('carousel').pause().to(slideIndex).cycle() + } + e.preventDefault() }) |