Add animations

This commit is contained in:
2020-09-19 18:00:03 +03:00
parent e2dfacbdaa
commit b2d4627650
2 changed files with 36 additions and 11 deletions

View File

@@ -1,9 +1,10 @@
<template> <template>
<transition appear name="fade"> <transition appear name="fade">
<div class="photo" <div class="photo-wrapper"
:style="photoStyle" :style="photoWrapperStyle"
ref="element" ref="element"
@click="onClick"> @click="onClick">
<div class="photo" :style="photoStyle"></div>
</div> </div>
</transition> </transition>
</template> </template>
@@ -45,7 +46,12 @@ export default class Photo extends Vue {
get photoStyle() { get photoStyle() {
return { return {
'background-image': `url('/pictures/albums/${this.album.folderName}/${this.file}')`, 'background-image': `url('/pictures/albums/${this.album.folderName}/${this.file}')`
}
}
get photoWrapperStyle() {
return {
'height': this.height, 'height': this.height,
} }
} }
@@ -69,34 +75,53 @@ export default class Photo extends Vue {
opacity: 0; opacity: 0;
} }
.photo-wrapper {
position: relative;
overflow: hidden;
transition: linear ;
transition: opacity 1s ease;
opacity: 1;
}
.photo-wrapper:hover {
transition: opacity 1s ease;
opacity: 0.5;
}
.photo { .photo {
background-size: cover; background-size: cover;
position: relative; transition: 1s;
width: 100%;
height: 100%;
}
.photo:hover {
transform: scale(1.2);
} }
@media (max-width: 461px) { @media (max-width: 461px) {
.photo { .photo-wrapper {
flex: 1 100%; flex: 1 100%;
max-width: 100%; max-width: 100%;
} }
} }
@media (min-width: 460px) and (max-width: 1401px) { @media (min-width: 460px) and (max-width: 1401px) {
.photo { .photo-wrapper {
flex: 1 50%; flex: 1 50%;
max-width: 50%; max-width: 50%;
} }
} }
@media (min-width: 1400px) and (max-width: 1501px) { @media (min-width: 1400px) and (max-width: 1501px) {
.photo { .photo-wrapper {
flex: 1 33.333%; flex: 1 33.333%;
max-width: 33.333%; max-width: 33.333%;
} }
} }
@media (min-width: 1500px) { @media (min-width: 1500px) {
.photo { .photo-wrapper {
flex: 1 25%; flex: 1 25%;
max-width: 25%; max-width: 25%;
} }

View File

@@ -15,7 +15,6 @@
:images="images" :images="images"
:index="index" :index="index"
@close="index = null"> @close="index = null">
<slot name="next">Next</slot>
</vue-gallery> </vue-gallery>
</div> </div>
</template> </template>
@@ -82,7 +81,7 @@ export default class AlbumPage extends Vue {
get images() { get images() {
return this.album!.files return this.album!.files
.map(item => `/pictures/albums/${this.album!.folderName}/${item}`); .map(item => `/pictures/albums/${this.album!.folderName}/${item}`);
} }
updateFiles() { updateFiles() {
@@ -137,6 +136,7 @@ export default class AlbumPage extends Vue {
flex-direction: row; flex-direction: row;
flex-wrap: wrap; flex-wrap: wrap;
} }
</style> </style>
<style> <style>