[U] reset interval on next/prev button click
This commit is contained in:
parent
1481678dac
commit
5b7485cbe9
3 changed files with 67 additions and 60 deletions
|
|
@ -4,7 +4,7 @@ new Vue({
|
||||||
files: [],
|
files: [],
|
||||||
index: 0,
|
index: 0,
|
||||||
interval: null,
|
interval: null,
|
||||||
carouselTimeout: 100,
|
carouselTimeout: 20000,
|
||||||
carouselActive: true
|
carouselActive: true
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
@ -14,9 +14,10 @@ new Vue({
|
||||||
} else {
|
} else {
|
||||||
this.index = 0;
|
this.index = 0;
|
||||||
}
|
}
|
||||||
if (!this.carouselActive) {
|
},
|
||||||
|
nextClick: function () {
|
||||||
|
this.next();
|
||||||
this.startCarousel();
|
this.startCarousel();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
prev: function () {
|
prev: function () {
|
||||||
if (this.index - 1 >= 0) {
|
if (this.index - 1 >= 0) {
|
||||||
|
|
@ -24,9 +25,10 @@ new Vue({
|
||||||
} else {
|
} else {
|
||||||
this.index = this.files.length - 1;
|
this.index = this.files.length - 1;
|
||||||
}
|
}
|
||||||
if (!this.carouselActive) {
|
},
|
||||||
|
prevClick: function () {
|
||||||
|
this.next();
|
||||||
this.startCarousel();
|
this.startCarousel();
|
||||||
}
|
|
||||||
},
|
},
|
||||||
loadData: function () {
|
loadData: function () {
|
||||||
fetch('api/files').then(response => response.json()).then(
|
fetch('api/files').then(response => response.json()).then(
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
#app, #app div {
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#app,
|
||||||
|
#app div {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -7,12 +12,13 @@
|
||||||
#app img {
|
#app img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
max-height: 100%;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
#app video {
|
#app video {
|
||||||
height: 100vh;
|
height: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
@ -48,4 +54,3 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top: 48vh;
|
margin-top: 48vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div v-if="files && files.length > 0">
|
<div v-if="files && files.length > 0">
|
||||||
<div class="floatBtn left" v-on:click="prev()">
|
<div class="floatBtn left" v-on:click="prevClick()">
|
||||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4 12C4 11.4477 4.44772 11 5 11H19C19.5523 11 20 11.4477 20 12C20 12.5523 19.5523 13 19 13H5C4.44772 13 4 12.5523 4 12Z" fill="currentColor"/></svg>
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M4 12C4 11.4477 4.44772 11 5 11H19C19.5523 11 20 11.4477 20 12C20 12.5523 19.5523 13 19 13H5C4.44772 13 4 12.5523 4 12Z" fill="currentColor"/></svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="floatBtn right" v-on:click="next()">
|
<div class="floatBtn right" v-on:click="nextClick()">
|
||||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M12 4C11.4477 4 11 4.44772 11 5V11H5C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H11V19C11 19.5523 11.4477 20 12 20C12.5523 20 13 19.5523 13 19V13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H13V5C13 4.44772 12.5523 4 12 4Z" fill="currentColor"/></svg>
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M12 4C11.4477 4 11 4.44772 11 5V11H5C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H11V19C11 19.5523 11.4477 20 12 20C12.5523 20 13 19.5523 13 19V13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H13V5C13 4.44772 12.5523 4 12 4Z" fill="currentColor"/></svg>
|
||||||
</div>
|
</div>
|
||||||
<div class="floatBtn bottom" v-on:click="toggleCarousel()">
|
<div class="floatBtn bottom" v-on:click="toggleCarousel()">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue