[U] fix timeout behaviour on prev/next+pause
This commit is contained in:
parent
367b4029d4
commit
d903c9333f
1 changed files with 3 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ new Vue({
|
|||
next: function () {
|
||||
this.carouselActive = true;
|
||||
clearTimeout(this.timeout);
|
||||
setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
||||
this.timeout = setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
||||
if (this.index + 1 < this.files.length) {
|
||||
this.index++;
|
||||
} else {
|
||||
|
|
@ -21,7 +21,7 @@ new Vue({
|
|||
prev: function () {
|
||||
this.carouselActive = true;
|
||||
clearTimeout(this.timeout);
|
||||
setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
||||
this.timeout = setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
||||
if (this.index - 1 >= 0) {
|
||||
this.index--;
|
||||
} else {
|
||||
|
|
@ -43,9 +43,9 @@ new Vue({
|
|||
)
|
||||
},
|
||||
toggleCarousel: function () {
|
||||
clearTimeout(this.timeout);
|
||||
if (this.carouselActive) {
|
||||
this.carouselActive = false;
|
||||
clearTimeout(this.timeout);
|
||||
} else {
|
||||
this.carouselActive = true;
|
||||
this.carousel();
|
||||
|
|
|
|||
Loading…
Reference in a new issue