1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-11 16:14:04 +02:00

Correct reference to Direction.PREV constant. (#21709)

This commit is contained in:
Pierre-Denis Vanduynslager
2017-01-14 21:46:03 -05:00
committed by Bardi Harborow
parent c80e13a48a
commit 8fbd4aaa38

View File

@@ -137,7 +137,7 @@ const Carousel = (($) => {
if (this._isSliding) { if (this._isSliding) {
throw new Error('Carousel is sliding') throw new Error('Carousel is sliding')
} }
this._slide(Direction.PREVIOUS) this._slide(Direction.PREV)
} }
pause(event) { pause(event) {
@@ -195,7 +195,7 @@ const Carousel = (($) => {
const direction = index > activeIndex ? const direction = index > activeIndex ?
Direction.NEXT : Direction.NEXT :
Direction.PREVIOUS Direction.PREV
this._slide(direction, this._items[index]) this._slide(direction, this._items[index])
} }
@@ -263,7 +263,7 @@ const Carousel = (($) => {
_getItemByDirection(direction, activeElement) { _getItemByDirection(direction, activeElement) {
const isNextDirection = direction === Direction.NEXT const isNextDirection = direction === Direction.NEXT
const isPrevDirection = direction === Direction.PREVIOUS const isPrevDirection = direction === Direction.PREV
const activeIndex = this._getItemIndex(activeElement) const activeIndex = this._getItemIndex(activeElement)
const lastItemIndex = this._items.length - 1 const lastItemIndex = this._items.length - 1
const isGoingToWrap = isPrevDirection && activeIndex === 0 || const isGoingToWrap = isPrevDirection && activeIndex === 0 ||
@@ -273,7 +273,7 @@ const Carousel = (($) => {
return activeElement return activeElement
} }
const delta = direction === Direction.PREVIOUS ? -1 : 1 const delta = direction === Direction.PREV ? -1 : 1
const itemIndex = (activeIndex + delta) % this._items.length const itemIndex = (activeIndex + delta) % this._items.length
return itemIndex === -1 ? return itemIndex === -1 ?