[U] reset interval on next/prev button click

This commit is contained in:
Jan 2020-07-20 12:42:08 +02:00
parent 1481678dac
commit 5b7485cbe9
3 changed files with 67 additions and 60 deletions

View file

@ -4,7 +4,7 @@ new Vue({
files: [],
index: 0,
interval: null,
carouselTimeout: 100,
carouselTimeout: 20000,
carouselActive: true
},
methods: {
@ -14,9 +14,10 @@ new Vue({
} else {
this.index = 0;
}
if (!this.carouselActive) {
},
nextClick: function () {
this.next();
this.startCarousel();
}
},
prev: function () {
if (this.index - 1 >= 0) {
@ -24,9 +25,10 @@ new Vue({
} else {
this.index = this.files.length - 1;
}
if (!this.carouselActive) {
},
prevClick: function () {
this.next();
this.startCarousel();
}
},
loadData: function () {
fetch('api/files').then(response => response.json()).then(

View file

@ -1,4 +1,9 @@
#app, #app div {
body {
margin: 0;
}
#app,
#app div {
display: flex;
height: 100%;
width: 100%;
@ -7,12 +12,13 @@
#app img {
width: 100%;
height: auto;
max-height: 100%;
z-index: 0;
align-self: center;
}
#app video {
height: 100vh;
height: 100%;
margin: 0 auto;
display: block;
}
@ -48,4 +54,3 @@
text-align: center;
margin-top: 48vh;
}

View file

@ -10,10 +10,10 @@
<body>
<div id="app">
<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>
</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>
</div>
<div class="floatBtn bottom" v-on:click="toggleCarousel()">