diff options
author | GeoSot <geo.sotis@gmail.com> | 2021-09-10 03:33:14 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2022-03-01 17:56:33 +0300 |
commit | 631cec4f70fa74b066c9d949aa5b8bf8cf06b46d (patch) | |
tree | 2c574d2e7713593014ec6d9fac12d7ef9188341b | |
parent | 7d9423d21c2b431b4413e6ac9d0c985ec74eb2c9 (diff) |
Carousel: refactor dataApiKeyHandler to avoid use of `carouselInterface`
-rw-r--r-- | js/src/carousel.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js index 7b22e9cbfe..a5fe2597b8 100644 --- a/js/src/carousel.js +++ b/js/src/carousel.js @@ -472,22 +472,22 @@ class Carousel extends BaseComponent { return } - const config = { - ...Manipulator.getDataAttributes(this) - } + event.preventDefault() + + const carousel = Carousel.getOrCreateInstance(target) const slideIndex = this.getAttribute('data-bs-slide-to') if (slideIndex) { - config.interval = false + carousel.to(slideIndex) + return } - Carousel.carouselInterface(target, config) - - if (slideIndex) { - Carousel.getInstance(target).to(slideIndex) + if (Manipulator.getDataAttribute(this, 'slide') === 'next') { + carousel.next() + return } - event.preventDefault() + carousel.prev() } } |