| 505 | // ================= |
| 506 | |
| 507 | var clickHandler = function (e) { |
| 508 | var href |
| 509 | var $this = $(this) |
| 510 | var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 |
| 511 | if (!$target.hasClass('carousel')) return |
| 512 | var options = $.extend({}, $target.data(), $this.data()) |
| 513 | var slideIndex = $this.attr('data-slide-to') |
| 514 | if (slideIndex) options.interval = false |
| 515 | |
| 516 | Plugin.call($target, options) |
| 517 | |
| 518 | if (slideIndex) { |
| 519 | $target.data('bs.carousel').to(slideIndex) |
| 520 | } |
| 521 | |
| 522 | e.preventDefault() |
| 523 | } |
| 524 | |
| 525 | $(document) |
| 526 | .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) |