diff options
| author | Chris Rebert <[email protected]> | 2014-04-21 13:16:57 -0700 |
|---|---|---|
| committer | Chris Rebert <[email protected]> | 2014-04-24 19:02:47 -0700 |
| commit | 4d0a8e31a46e54bb180eadb2844d1e4a9c7c4e91 (patch) | |
| tree | 8acae8d90a9bbbf614f10eba8be8b322009d36b3 | |
| parent | f66a747615c5216b8cd81c699149f993e8f28608 (diff) | |
| download | bootstrap-4d0a8e31a46e54bb180eadb2844d1e4a9c7c4e91.tar.xz bootstrap-4d0a8e31a46e54bb180eadb2844d1e4a9c7c4e91.zip | |
Add direction & relatedTarget properties to slid.bs.carousel event
Fixes #13393
| -rw-r--r-- | js/carousel.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/js/carousel.js b/js/carousel.js index 9f063aec0..14a379fbf 100644 --- a/js/carousel.js +++ b/js/carousel.js @@ -103,7 +103,8 @@ if ($next.hasClass('active')) return this.sliding = false - var e = $.Event('slide.bs.carousel', { relatedTarget: $next[0], direction: direction }) + var relatedTarget = $next[0] + var e = $.Event('slide.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) this.$element.trigger(e) if (e.isDefaultPrevented()) return @@ -119,6 +120,7 @@ }) } + var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid". not a typo. past tense of "to slide". if ($.support.transition && this.$element.hasClass('slide')) { $next.addClass(type) $next[0].offsetWidth // force reflow @@ -129,14 +131,14 @@ $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false - setTimeout(function () { that.$element.trigger('slid.bs.carousel') }, 0) // yes, "slid". not a typo. past tense of "to slide". + setTimeout(function () { that.$element.trigger(slidEvent) }, 0) }) .emulateTransitionEnd($active.css('transition-duration').slice(0, -1) * 1000) } else { $active.removeClass('active') $next.addClass('active') this.sliding = false - this.$element.trigger('slid.bs.carousel') // yes, "slid". not a typo. past tense of "to slide". + this.$element.trigger(slidEvent) } isCycling && this.cycle() |
