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