mirror of https://github.com/twbs/bootstrap.git
fix(carousel): switch prev/next directions in RTL
This commit is contained in:
parent
e967ecf900
commit
b85ca045e0
|
|
@ -11,6 +11,7 @@ import {
|
||||||
getElementFromSelector,
|
getElementFromSelector,
|
||||||
getTransitionDurationFromElement,
|
getTransitionDurationFromElement,
|
||||||
isVisible,
|
isVisible,
|
||||||
|
isRTL,
|
||||||
reflow,
|
reflow,
|
||||||
triggerTransitionEnd,
|
triggerTransitionEnd,
|
||||||
typeCheckConfig
|
typeCheckConfig
|
||||||
|
|
@ -250,12 +251,20 @@ class Carousel extends BaseComponent {
|
||||||
|
|
||||||
// swipe left
|
// swipe left
|
||||||
if (direction > 0) {
|
if (direction > 0) {
|
||||||
this.prev()
|
if (isRTL) {
|
||||||
|
this.next()
|
||||||
|
} else {
|
||||||
|
this.prev()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swipe right
|
// swipe right
|
||||||
if (direction < 0) {
|
if (direction < 0) {
|
||||||
this.next()
|
if (isRTL) {
|
||||||
|
this.prev()
|
||||||
|
} else {
|
||||||
|
this.next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -339,10 +348,18 @@ class Carousel extends BaseComponent {
|
||||||
|
|
||||||
if (event.key === ARROW_LEFT_KEY) {
|
if (event.key === ARROW_LEFT_KEY) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.prev()
|
if (isRTL) {
|
||||||
|
this.next()
|
||||||
|
} else {
|
||||||
|
this.prev()
|
||||||
|
}
|
||||||
} else if (event.key === ARROW_RIGHT_KEY) {
|
} else if (event.key === ARROW_RIGHT_KEY) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
this.next()
|
if (isRTL) {
|
||||||
|
this.prev()
|
||||||
|
} else {
|
||||||
|
this.next()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue