From edc3eee5eaae52384de1486639585c0b41318cf8 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Wed, 17 Oct 2012 22:26:44 -0700 Subject: fix carousel event --- docs/assets/js/bootstrap.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'docs/assets/js/bootstrap.js') diff --git a/docs/assets/js/bootstrap.js b/docs/assets/js/bootstrap.js index e96798039..1b2521a96 100644 --- a/docs/assets/js/bootstrap.js +++ b/docs/assets/js/bootstrap.js @@ -337,9 +337,7 @@ , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this - , e = $.Event('slide', { - relatedTarget: $next[0] - }) + , e this.sliding = true @@ -347,6 +345,10 @@ $next = $next.length ? $next : this.$element.find('.item')[fallback]() + e = $.Event('slide', { + relatedTarget: $next[0] + }) + if ($next.hasClass('active')) return if ($.support.transition && this.$element.hasClass('slide')) { @@ -410,7 +412,7 @@ $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { var $this = $(this), href , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 - , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) + , options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data()) $target.carousel(options) e.preventDefault() }) @@ -1193,8 +1195,9 @@ this.enabled = !this.enabled } - , toggle: function () { - this[this.tip().hasClass('in') ? 'hide' : 'show']() + , toggle: function (e) { + var self = $(e.currentTarget)[this.type](this._options).data(this.type) + self[self.tip().hasClass('in') ? 'hide' : 'show']() } , destroy: function () { -- cgit v1.2.3