| 206 | // ================= |
| 207 | |
| 208 | var clickHandler = function (e) { |
| 209 | var href |
| 210 | var $this = $(this) |
| 211 | var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 |
| 212 | if (!$target.hasClass('carousel')) return |
| 213 | var options = $.extend({}, $target.data(), $this.data()) |
| 214 | var slideIndex = $this.attr('data-slide-to') |
| 215 | if (slideIndex) options.interval = false |
| 216 | |
| 217 | Plugin.call($target, options) |
| 218 | |
| 219 | if (slideIndex) { |
| 220 | $target.data('bs.carousel').to(slideIndex) |
| 221 | } |
| 222 | |
| 223 | e.preventDefault() |
| 224 | } |
| 225 | |
| 226 | $(document) |
| 227 | .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) |