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