[U] fix timeout behaviour on prev/next+pause

This commit is contained in:
Jan 2020-07-17 11:23:39 +02:00
parent 367b4029d4
commit d903c9333f

View file

@ -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();