galleries: scroll to gallery thumb on page load
This commit is contained in:
parent
5832cea526
commit
79fa211995
|
@ -1,6 +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"
|
||||||
|
ref="galleries"
|
||||||
class="featured-image thumb-overlay selected-indicator"
|
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 + ')' }"
|
||||||
|
@ -26,6 +27,10 @@ export default {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
mounted () {
|
||||||
|
this.$refs.galleries[this.galleryActive].scrollIntoView({behavior: 'smooth'})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -55,10 +55,28 @@ export default {
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
viewingImageUrl () {
|
viewingImageUrl () {
|
||||||
return this.galleries[this.activeGalleryIndex].images[this.activeImageIndex].url
|
if (
|
||||||
|
this.galleries[this.activeGalleryIndex]
|
||||||
|
&& this.galleries[this.activeGalleryIndex].images
|
||||||
|
&& this.galleries[this.activeGalleryIndex].images[this.activeImageIndex]
|
||||||
|
) {
|
||||||
|
console.log('found')
|
||||||
|
return this.galleries[this.activeGalleryIndex].images[this.activeImageIndex].url
|
||||||
|
} else {
|
||||||
|
console.log('not found')
|
||||||
|
// TOOD return 404 page - does this do it?
|
||||||
|
throw({ statusCode: 404, message: 'Image Not Found' })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
created () {
|
||||||
|
let query = this.$route.query
|
||||||
|
this.activeGalleryIndex = query.gallery ? parseInt(query.gallery) : 0
|
||||||
|
this.activeRow = this.activeGalleryIndex
|
||||||
|
this.activeImageIndex = query.image ? parseInt(query.image) : 0
|
||||||
|
},
|
||||||
|
|
||||||
mounted () {
|
mounted () {
|
||||||
window.addEventListener('resize', () => { this.imageViewerIsVisible = false })
|
window.addEventListener('resize', () => { this.imageViewerIsVisible = false })
|
||||||
},
|
},
|
||||||
|
|
|
@ -53,28 +53,28 @@ export default {
|
||||||
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-portraits.jpg',
|
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-portraits.jpg',
|
||||||
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-portraits.jpg',
|
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-portraits.jpg',
|
||||||
'html': '<p>Corporate portraits and publicity photos for printed materials, including annual reports and newsletters.</p>',
|
'html': '<p>Corporate portraits and publicity photos for printed materials, including annual reports and newsletters.</p>',
|
||||||
'linkUrl': '#',
|
'linkUrl': 'galleries?gallery=0',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'heading': 'Dance',
|
'heading': 'Dance',
|
||||||
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-dance.jpg',
|
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-dance.jpg',
|
||||||
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-dance.jpg',
|
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-dance.jpg',
|
||||||
'html': '<p>Photography and video production of dancers and performances for print, web, and promotion.</p>',
|
'html': '<p>Photography and video production of dancers and performances for print, web, and promotion.</p>',
|
||||||
'linkUrl': '#',
|
'linkUrl': 'galleries?gallery=1',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'heading': 'Music',
|
'heading': 'Music',
|
||||||
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-music.jpg',
|
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-music.jpg',
|
||||||
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-music.jpg',
|
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-music.jpg',
|
||||||
'html': '<p>Photography and video of musical performances and portraits for print and the web, CD covers, and publicity photos.</p>',
|
'html': '<p>Photography and video of musical performances and portraits for print and the web, CD covers, and publicity photos.</p>',
|
||||||
'linkUrl': '#',
|
'linkUrl': 'galleries?gallery=2',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'heading': 'Events',
|
'heading': 'Events',
|
||||||
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-events.jpg',
|
'imageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-events.jpg',
|
||||||
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-events.jpg',
|
'backgroundImageUrl': 'https://marcleopold.isnet.uk/wp-content/uploads/2017/07/services-events.jpg',
|
||||||
'html': '<p>Photography and video production for your corporate, organisational and personal events and celebrations.</p>',
|
'html': '<p>Photography and video production for your corporate, organisational and personal events and celebrations.</p>',
|
||||||
'linkUrl': '#',
|
'linkUrl': 'galleries?gallery=3',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue