diff options
| author | Gaƫl Poupard <[email protected]> | 2020-12-11 15:10:58 +0100 |
|---|---|---|
| committer | XhmikosR <[email protected]> | 2020-12-14 11:11:47 +0200 |
| commit | b85ca045e057d6f5982cc0cc9de4bfbf8b252a3d (patch) | |
| tree | 0593456ce2fa309cf06bc6028e6dbe9a9726831b /js/src/carousel.js | |
| parent | e967ecf90021b9666bc5184f9054e7d37f9d83f4 (diff) | |
| download | bootstrap-b85ca045e057d6f5982cc0cc9de4bfbf8b252a3d.tar.xz bootstrap-b85ca045e057d6f5982cc0cc9de4bfbf8b252a3d.zip | |
fix(carousel): switch prev/next directions in RTL
Diffstat (limited to 'js/src/carousel.js')
| -rw-r--r-- | js/src/carousel.js | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index a266ec10f..06a391419 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -11,6 +11,7 @@ import { getElementFromSelector, getTransitionDurationFromElement, isVisible, + isRTL, reflow, triggerTransitionEnd, typeCheckConfig @@ -250,12 +251,20 @@ class Carousel extends BaseComponent { // swipe left if (direction > 0) { - this.prev() + if (isRTL) { + this.next() + } else { + this.prev() + } } // swipe right 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) { event.preventDefault() - this.prev() + if (isRTL) { + this.next() + } else { + this.prev() + } } else if (event.key === ARROW_RIGHT_KEY) { event.preventDefault() - this.next() + if (isRTL) { + this.prev() + } else { + this.next() + } } } |
