diff --git a/components/GalleryFeatured.vue b/components/GalleryFeatured.vue index 860be54..564719d 100644 --- a/components/GalleryFeatured.vue +++ b/components/GalleryFeatured.vue @@ -29,7 +29,11 @@ export default { }, mounted () { - this.$refs.galleries[this.galleryActive].scrollIntoView({behavior: 'smooth'}) + // 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'}) }, }