highlight active image in GalleryThumbs

This commit is contained in:
ManjaroOne666 2019-01-28 09:20:17 +00:00
parent 3239d05b4a
commit f0ded60d7d
5 changed files with 35 additions and 22 deletions

View File

@ -1,5 +1,6 @@
## Galleries ## Galleries
* Use query strings to specify index of selected gallery - can update on navigating galleries * scroll to correct gallery when query parameter changes on galleries page
* also do same for thumbnail selected
## Menu ## Menu
* Proper background images for hover effect * Proper background images for hover effect

View File

@ -119,3 +119,25 @@
background-color: rgba($color__primary-100, .7); background-color: rgba($color__primary-100, .7);
} }
.selected-indicator {
&::before {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transition: opacity 1s;
opacity: 0;
border: 1px solid $color__neutral-700;;
}
&.is-active::before {
transition: opacity 2s .2s;
opacity: 1;
}
}

View File

@ -1,7 +1,7 @@
<template> <template>
<ul class="gallery-featured"> <ul class="gallery-featured">
<li v-for="(gallery, index) in galleries" <li v-for="(gallery, index) in galleries"
class="featured-image thumb-overlay" class="featured-image thumb-overlay selected-indicator"
:class="{ 'is-active': index === galleryActive }" :class="{ 'is-active': index === galleryActive }"
:style="{ 'background-image': 'url(' + gallery.featuredImage + ')' }" :style="{ 'background-image': 'url(' + gallery.featuredImage + ')' }"
:key="index" :key="index"
@ -97,25 +97,6 @@ export default {
padding-top: 100%; padding-top: 100%;
margin-bottom: 4px; margin-bottom: 4px;
&::before {
content: '';
display: block;
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transition: opacity 1s;
opacity: 0;
border: 1px solid $color__neutral-700;;
}
&.is-active::before {
transition: opacity 2s .2s;
opacity: 1;
}
} }
.gallery-title { .gallery-title {

View File

@ -18,6 +18,7 @@
:featured-height="featuredImageHeight" :featured-height="featuredImageHeight"
:galleries="galleries" :galleries="galleries"
:active-row="activeRow" :active-row="activeRow"
:active-index="activeImageIndex"
@thumbClick="handleThumbClick"/> @thumbClick="handleThumbClick"/>
</article> </article>
</div> </div>

View File

@ -18,7 +18,8 @@
</li> </li>
<li v-for="(image, imageIndex) in gallery.images" <li v-for="(image, imageIndex) in gallery.images"
:ref="galleryIndex == 0 && imageIndex == 0 ? 'thumbContainer' : null" :ref="galleryIndex == 0 && imageIndex == 0 ? 'thumbContainer' : null"
class="thumb-container thumb-overlay" class="thumb-container thumb-overlay selected-indicator"
:class="{ 'is-active': imageIndex === activeIndex }"
:style="{ 'background-image': 'url(' + image.thumbUrl + ')' }" :style="{ 'background-image': 'url(' + image.thumbUrl + ')' }"
:key="galleryIndex + '.' + imageIndex + '.' + image.url" :key="galleryIndex + '.' + imageIndex + '.' + image.url"
@click="$emit('thumbClick', galleryIndex, imageIndex)"> @click="$emit('thumbClick', galleryIndex, imageIndex)">
@ -64,6 +65,13 @@ export default {
activeRow: { activeRow: {
type: Number, type: Number,
required: true required: true
},
activeIndex: {
type: Number,
required: false,
default () {
return 0
},
} }
}, },