From 4ab06ca4534da28858c013e765a9ad34f508e4d7 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sun, 26 Mar 2017 11:26:31 -0700 Subject: grunt --- js/dist/carousel.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'js/dist/carousel.js') diff --git a/js/dist/carousel.js b/js/dist/carousel.js index 6e4269245..f7af6550e 100644 --- a/js/dist/carousel.js +++ b/js/dist/carousel.js @@ -272,9 +272,13 @@ var Carousel = function ($) { }; Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { + var targetIndex = this._getItemIndex(relatedTarget); + var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]); var slideEvent = $.Event(Event.SLIDE, { relatedTarget: relatedTarget, - direction: eventDirectionName + direction: eventDirectionName, + from: fromIndex, + to: targetIndex }); $(this._element).trigger(slideEvent); @@ -298,8 +302,9 @@ var Carousel = function ($) { var _this3 = this; var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; + var activeElementIndex = this._getItemIndex(activeElement); var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); - + var nextElementIndex = this._getItemIndex(nextElement); var isCycling = Boolean(this._interval); var directionalClassName = void 0; @@ -341,7 +346,9 @@ var Carousel = function ($) { var slidEvent = $.Event(Event.SLID, { relatedTarget: nextElement, - direction: eventDirectionName + direction: eventDirectionName, + from: activeElementIndex, + to: nextElementIndex }); if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) { -- cgit v1.2.3 From 49b6cf845d3d3bf49197a529548489f9a1a76709 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Sat, 1 Apr 2017 19:18:29 -0700 Subject: grunt --- js/dist/carousel.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'js/dist/carousel.js') diff --git a/js/dist/carousel.js b/js/dist/carousel.js index f7af6550e..77d6e80d9 100644 --- a/js/dist/carousel.js +++ b/js/dist/carousel.js @@ -112,10 +112,9 @@ var Carousel = function ($) { // public Carousel.prototype.next = function next() { - if (this._isSliding) { - throw new Error('Carousel is sliding'); + if (!this._isSliding) { + this._slide(Direction.NEXT); } - this._slide(Direction.NEXT); }; Carousel.prototype.nextWhenVisible = function nextWhenVisible() { @@ -126,10 +125,9 @@ var Carousel = function ($) { }; Carousel.prototype.prev = function prev() { - if (this._isSliding) { - throw new Error('Carousel is sliding'); + if (!this._isSliding) { + this._slide(Direction.PREV); } - this._slide(Direction.PREV); }; Carousel.prototype.pause = function pause(event) { -- cgit v1.2.3