diff options
| author | Mark Otto <[email protected]> | 2016-12-07 20:46:17 -0800 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2016-12-07 20:46:17 -0800 |
| commit | cd76a6775de677210c25608f4d359ce429df995b (patch) | |
| tree | db5c36a8b92a8740c007d4f3c8ef17a7454d0c99 /js/dist/carousel.js | |
| parent | ede925d79bf92d5983a4508c6ed6fda9310e1e8b (diff) | |
| download | bootstrap-cd76a6775de677210c25608f4d359ce429df995b.tar.xz bootstrap-cd76a6775de677210c25608f4d359ce429df995b.zip | |
grunt
Diffstat (limited to 'js/dist/carousel.js')
| -rw-r--r-- | js/dist/carousel.js | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/js/dist/carousel.js b/js/dist/carousel.js index 60803b9fc..b0af32d6b 100644 --- a/js/dist/carousel.js +++ b/js/dist/carousel.js @@ -47,7 +47,9 @@ var Carousel = function ($) { var Direction = { NEXT: 'next', - PREVIOUS: 'prev' + PREV: 'prev', + LEFT: 'left', + RIGHT: 'right' }; var Event = { @@ -64,8 +66,10 @@ var Carousel = function ($) { CAROUSEL: 'carousel', ACTIVE: 'active', SLIDE: 'slide', - RIGHT: 'right', - LEFT: 'left', + RIGHT: 'carousel-item-right', + LEFT: 'carousel-item-left', + NEXT: 'carousel-item-next', + PREV: 'carousel-item-prev', ITEM: 'carousel-item' }; @@ -73,7 +77,7 @@ var Carousel = function ($) { ACTIVE: '.active', ACTIVE_ITEM: '.active.carousel-item', ITEM: '.carousel-item', - NEXT_PREV: '.next, .prev', + NEXT_PREV: '.carousel-item-next, .carousel-item-prev', INDICATORS: '.carousel-indicators', DATA_SLIDE: '[data-slide], [data-slide-to]', DATA_RIDE: '[data-ride="carousel"]' @@ -266,10 +270,10 @@ var Carousel = function ($) { return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; }; - Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, directionalClassname) { + Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { var slideEvent = $.Event(Event.SLIDE, { relatedTarget: relatedTarget, - direction: directionalClassname + direction: eventDirectionName }); $(this._element).trigger(slideEvent); @@ -297,14 +301,26 @@ var Carousel = function ($) { var isCycling = Boolean(this._interval); - var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT; + var directionalClassName = void 0; + var orderClassName = void 0; + var eventDirectionName = void 0; + + if (direction === Direction.NEXT) { + directionalClassName = ClassName.LEFT; + orderClassName = ClassName.NEXT; + eventDirectionName = Direction.LEFT; + } else { + directionalClassName = ClassName.RIGHT; + orderClassName = ClassName.PREV; + eventDirectionName = Direction.RIGHT; + } if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { this._isSliding = false; return; } - var slideEvent = this._triggerSlideEvent(nextElement, directionalClassName); + var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); if (slideEvent.isDefaultPrevented()) { return; } @@ -324,12 +340,12 @@ var Carousel = function ($) { var slidEvent = $.Event(Event.SLID, { relatedTarget: nextElement, - direction: directionalClassName + direction: eventDirectionName }); if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) { - $(nextElement).addClass(direction); + $(nextElement).addClass(orderClassName); Util.reflow(nextElement); @@ -337,9 +353,9 @@ var Carousel = function ($) { $(nextElement).addClass(directionalClassName); $(activeElement).one(Util.TRANSITION_END, function () { - $(nextElement).removeClass(directionalClassName + ' ' + direction).addClass(ClassName.ACTIVE); + $(nextElement).removeClass(directionalClassName + ' ' + orderClassName).addClass(ClassName.ACTIVE); - $(activeElement).removeClass(ClassName.ACTIVE + ' ' + direction + ' ' + directionalClassName); + $(activeElement).removeClass(ClassName.ACTIVE + ' ' + orderClassName + ' ' + directionalClassName); _this3._isSliding = false; |
