Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorGeoSot <geo.sotis@gmail.com>2021-09-10 02:11:14 +0300
committerXhmikosR <xhmikosr@gmail.com>2021-12-21 18:37:24 +0300
commitff4bf4a458d1bfab6a3cb8803e762fdb0de8bc3e (patch)
tree08a5551e90d0d15290d78f20ae9967828be3cd85 /js
parent6f79721c82ecef5a4a25482e915ffa157965702c (diff)
Carousel: move carousel default interval to `_getConfig()` and simplify it
Diffstat (limited to 'js')
-rw-r--r--js/src/carousel.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index 856d70dac0..336bcd261a 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -161,7 +161,7 @@ class Carousel extends BaseComponent {
this._interval = null
}
- if (this._config && this._config.interval && !this._isPaused) {
+ if (this._config.interval && !this._isPaused) {
this._updateInterval()
this._interval = setInterval(
@@ -206,6 +206,11 @@ class Carousel extends BaseComponent {
}
// Private
+ _configAfterMerge(config) {
+ config.defaultInterval = config.interval
+ return config
+ }
+
_addEventListeners() {
if (this._config.keyboard) {
EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))
@@ -318,12 +323,7 @@ class Carousel extends BaseComponent {
const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)
- if (elementInterval) {
- this._config.defaultInterval = this._config.defaultInterval || this._config.interval
- this._config.interval = elementInterval
- } else {
- this._config.interval = this._config.defaultInterval || this._config.interval
- }
+ this._config.interval = elementInterval || this._config.defaultInterval
}
_slide(directionOrOrder, element) {