fix: galeryPage featured thumb now scrolls to show active gallery correctly
This commit is contained in:
parent
e415efe7bc
commit
17472ebca2
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<ul class="gallery-featured">
|
<ul class="gallery-featured" ref="galleryList">
|
||||||
<li v-for="(gallery, index) in galleries"
|
<li v-for="(gallery, index) in galleries"
|
||||||
ref="galleries"
|
ref="galleries"
|
||||||
class="featured-image thumb-overlay selected-indicator"
|
class="featured-image thumb-overlay selected-indicator"
|
||||||
|
@ -29,11 +29,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted () {
|
mounted () {
|
||||||
// cannot just use this.galleryActive as if we do and it is the last element
|
if (this.galleryActive > 0) {
|
||||||
// chrome (at least?) pushes body up and creates wierd gap at bottom of body
|
const el = this.$refs.galleries[this.galleryActive]
|
||||||
// to get round this we will just scroll to the second last element in this case
|
el.parentNode.scrollTop = el.offsetTop
|
||||||
const index = this.galleryActive >= this.galleries.length - 1 ? this.galleryActive - 1 : this.galleryActive
|
}
|
||||||
this.$refs.galleries[index].scrollIntoView({behavior: 'smooth'})
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -70,8 +70,8 @@ export default {
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
$route () {
|
$route () {
|
||||||
if (!query || !query.gallery) { return }
|
|
||||||
const query = this.$route.query
|
const query = this.$route.query
|
||||||
|
if (!query || !query.gallery) { return }
|
||||||
const gallery = parseInt(query.gallery)
|
const gallery = parseInt(query.gallery)
|
||||||
const image = parseInt(query.image) || 0
|
const image = parseInt(query.image) || 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue