[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 () {
|
next: function () {
|
||||||
this.carouselActive = true;
|
this.carouselActive = true;
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
this.timeout = setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
||||||
if (this.index + 1 < this.files.length) {
|
if (this.index + 1 < this.files.length) {
|
||||||
this.index++;
|
this.index++;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -21,7 +21,7 @@ new Vue({
|
||||||
prev: function () {
|
prev: function () {
|
||||||
this.carouselActive = true;
|
this.carouselActive = true;
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
this.timeout = setTimeout(() => this.carousel(), this.carouselTimeout*2);
|
||||||
if (this.index - 1 >= 0) {
|
if (this.index - 1 >= 0) {
|
||||||
this.index--;
|
this.index--;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -43,9 +43,9 @@ new Vue({
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
toggleCarousel: function () {
|
toggleCarousel: function () {
|
||||||
|
clearTimeout(this.timeout);
|
||||||
if (this.carouselActive) {
|
if (this.carouselActive) {
|
||||||
this.carouselActive = false;
|
this.carouselActive = false;
|
||||||
clearTimeout(this.timeout);
|
|
||||||
} else {
|
} else {
|
||||||
this.carouselActive = true;
|
this.carouselActive = true;
|
||||||
this.carousel();
|
this.carousel();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue