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
diff options
context:
space:
mode:
authorMark Otto <markdotto@gmail.com>2016-12-05 08:05:19 +0300
committerMark Otto <markdotto@gmail.com>2016-12-05 08:05:19 +0300
commit1e3ec8935520e2d118d9d7742abd80183d34beb2 (patch)
tree3a2e940d7d91d578db4fe86675fa9d2a11bb9512 /js/src/carousel.js
parent6782dd6e92637f85e3778584ec417a775d01243f (diff)
parent5a19d4870537ca85ba38beeb7eabe80858417b72 (diff)
Merge branch 'v4-dev' into carousel
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r--js/src/carousel.js24
1 files changed, 10 insertions, 14 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index c0d572f0a9..a8c16283e2 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -120,9 +120,10 @@ const Carousel = (($) => {
// public
next() {
- if (!this._isSliding) {
- this._slide(Direction.NEXT)
+ if (this._isSliding) {
+ throw new Error('Carousel is sliding')
}
+ this._slide(Direction.NEXT)
}
nextWhenVisible() {
@@ -133,9 +134,10 @@ const Carousel = (($) => {
}
prev() {
- if (!this._isSliding) {
- this._slide(Direction.PREVIOUS)
+ if (this._isSliding) {
+ throw new Error('Carousel is sliding')
}
+ this._slide(Direction.PREVIOUS)
}
pause(event) {
@@ -236,11 +238,10 @@ const Carousel = (($) => {
}
_keydown(event) {
- event.preventDefault()
-
if (/input|textarea/i.test(event.target.tagName)) {
return
}
+ event.preventDefault()
switch (event.which) {
case ARROW_LEFT_KEYCODE:
@@ -372,15 +373,10 @@ const Carousel = (($) => {
$(activeElement)
.one(Util.TRANSITION_END, () => {
$(nextElement)
- .removeClass(directionalClassName)
- .removeClass(orderClassName)
-
- $(nextElement).addClass(ClassName.ACTIVE)
+ .removeClass(`${directionalClassName} ${orderClassName}`)
+ .addClass(ClassName.ACTIVE)
- $(activeElement)
- .removeClass(ClassName.ACTIVE)
- .removeClass(orderClassName)
- .removeClass(directionalClassName)
+ $(activeElement).removeClass(`${ClassName.ACTIVE} ${orderClassName} ${directionalClassName}`)
this._isSliding = false