thumbnail rows (large devices) shown when active
This commit is contained in:
parent
47bce5073b
commit
11c1996e46
1
TODO.md
1
TODO.md
|
@ -1,2 +1,3 @@
|
||||||
## Services Page
|
## Services Page
|
||||||
* Have background change as scrolling down the services?
|
* Have background change as scrolling down the services?
|
||||||
|
* menu items (large devices) = nice big images with text coming out
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
<li v-for="(gallery, index) in galleries"
|
<li v-for="(gallery, index) in galleries"
|
||||||
class="featured-image"
|
class="featured-image"
|
||||||
:style="{ 'height': featuredHeight }"
|
:style="{ 'height': featuredHeight }"
|
||||||
:key="index">
|
:key="index"
|
||||||
|
@click="$emit('clicked', index)">
|
||||||
<span>{{ gallery.title }}</span>
|
<span>{{ gallery.title }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -6,10 +6,12 @@
|
||||||
<div class="gallery">
|
<div class="gallery">
|
||||||
<GalleryFeatured class="gallery__featured"
|
<GalleryFeatured class="gallery__featured"
|
||||||
:featured-height="featuredImageHeight"
|
:featured-height="featuredImageHeight"
|
||||||
:galleries="galleries" />
|
:galleries="galleries"
|
||||||
|
@clicked="handleFeaturedClick" />
|
||||||
<GalleryThumbs class="gallery__thumbs"
|
<GalleryThumbs class="gallery__thumbs"
|
||||||
:featured-height="featuredImageHeight"
|
:featured-height="featuredImageHeight"
|
||||||
:galleries="galleries" />
|
:galleries="galleries"
|
||||||
|
:active-row="activeRow" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -36,11 +38,15 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
featuredImageHeight: '16rem',
|
featuredImageHeight: '16rem',
|
||||||
imageViewerIsVisible: false
|
imageViewerIsVisible: false,
|
||||||
|
activeRow: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
handleFeaturedClick (index) {
|
||||||
|
this.activeRow = index
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
<div class="gallery-thumbs__spacer"></div>
|
<div class="gallery-thumbs__spacer"></div>
|
||||||
<ul class="gallery-thumbs__list">
|
<ul class="gallery-thumbs__list">
|
||||||
<li v-for="(gallery, galleryIndex) in galleries"
|
<li v-for="(gallery, galleryIndex) in galleries"
|
||||||
:key="galleryIndex">
|
:key="galleryIndex"
|
||||||
|
:class="{ 'is-active': activeRow === galleryIndex }"
|
||||||
|
class="gallery-thumbs__row-container">
|
||||||
<ul :ref="'thumbs-row-' + galleryIndex"
|
<ul :ref="'thumbs-row-' + galleryIndex"
|
||||||
class="gallery-thumbs__row"
|
class="gallery-thumbs__row"
|
||||||
:style="{ 'transform': 'translate3d(-' + thumbRowOffsets[galleryIndex] + 'px, 0, 0)' }">
|
:style="{ 'transform': 'translate3d(-' + thumbRowOffsets[galleryIndex] + 'px, 0, 0)' }">
|
||||||
|
@ -11,7 +13,7 @@
|
||||||
:style="{ 'height': featuredHeight }">
|
:style="{ 'height': featuredHeight }">
|
||||||
<ThumbNav class="thumb-nav thumb-nav--large"
|
<ThumbNav class="thumb-nav thumb-nav--large"
|
||||||
direction="right"
|
direction="right"
|
||||||
@clicked="handleNavClick(galleryIndex, 'right')" />
|
@navClick="handleNavClick(galleryIndex, 'right')" />
|
||||||
</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"
|
||||||
|
@ -19,12 +21,13 @@
|
||||||
:key="galleryIndex + '.' + imageIndex + '.' + image.url">
|
:key="galleryIndex + '.' + imageIndex + '.' + image.url">
|
||||||
<ThumbNav class="thumb-nav thumb-nav--left"
|
<ThumbNav class="thumb-nav thumb-nav--left"
|
||||||
direction="left"
|
direction="left"
|
||||||
@clicked="handleNavClick(galleryIndex, 'left')" />
|
@navClick="handleNavClick(galleryIndex, 'left')" />
|
||||||
<ThumbNav v-if="imageIndex < gallery.images.length - 1"
|
<ThumbNav v-if="imageIndex < gallery.images.length - 1"
|
||||||
class="thumb-nav"
|
class="thumb-nav"
|
||||||
direction="right"
|
direction="right"
|
||||||
@clicked="handleNavClick(galleryIndex, 'right')" />
|
@navClick="handleNavClick(galleryIndex, 'right')" />
|
||||||
<span>{{ image.thumbUrl }}</span>
|
<span>{{ image.thumbUrl }}</span>
|
||||||
|
<span>{{ galleryIndex }}: {{ imageIndex }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -48,13 +51,23 @@ export default {
|
||||||
featuredHeight: {
|
featuredHeight: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
activeRow: {
|
||||||
|
type: Number,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
thumbRowOffsets: new Array(this.galleries.length),
|
thumbRowOffsets: new Array(this.galleries.length),
|
||||||
// thumbContainerWidth: 0
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
thumbsVerticalOffset () {
|
||||||
|
let rowHeight = this.$refs.thumbContainer ? this.$refs.thumbContainer[0].clientHeight : 0;
|
||||||
|
return rowHeight * this.activeRow
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -80,7 +93,6 @@ export default {
|
||||||
offset += thumbContainerWidth
|
offset += thumbContainerWidth
|
||||||
}
|
}
|
||||||
offset = offset < 0 ? 0 : offset
|
offset = offset < 0 ? 0 : offset
|
||||||
console.log('offset: ', offset)
|
|
||||||
this.$set(this.thumbRowOffsets, source, offset)
|
this.$set(this.thumbRowOffsets, source, offset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,14 +165,36 @@ export default {
|
||||||
height: $thumbs-height;
|
height: $thumbs-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gallery__thumbs {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.gallery-thumbs__list {
|
.gallery-thumbs__list {
|
||||||
height: $thumbs-height;
|
height: $thumbs-height;
|
||||||
|
flex: 0 0 $thumbs-height;
|
||||||
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.gallery-thumbs__row-container {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
transition: opacity .5s;
|
||||||
|
opacity: 0;
|
||||||
|
|
||||||
|
&.is-active {
|
||||||
|
transition: opacity .5s .3s;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.gallery-thumbs__row {
|
.gallery-thumbs__row {
|
||||||
flex: 0 0 $thumbs-height;
|
/* flex: 0 0 $thumbs-height; */
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width: 10rem;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumb-nav {
|
.thumb-nav {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div @click="$emit('clicked')">ThumbNav--{{ direction }}</div>
|
<div @click="$emit('navClick')">ThumbNav--{{ direction }}</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue