aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorfat <[email protected]>2012-12-21 19:45:19 -0800
committerfat <[email protected]>2012-12-21 19:45:19 -0800
commit24a36df9f6afa27de0dcc44799c9ab428969d8ca (patch)
tree84b08b90c35ac5b0ad534487afdf1dd7b5c1d417 /js
parent818c56f078ff3b14fefceca77608d1e95f33a783 (diff)
downloadbootstrap-24a36df9f6afa27de0dcc44799c9ab428969d8ca.tar.xz
bootstrap-24a36df9f6afa27de0dcc44799c9ab428969d8ca.zip
add support for [data-slide-to] attr on carousel
Diffstat (limited to 'js')
-rw-r--r--js/bootstrap-carousel.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/js/bootstrap-carousel.js b/js/bootstrap-carousel.js
index dbea83711..c73da092a 100644
--- a/js/bootstrap-carousel.js
+++ b/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()
})