From 05fd4e979218d681315d243a1b65b46be0841cc2 Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Mon, 28 Jan 2019 12:17:43 +0000 Subject: [PATCH] smooth scrolling to featured thumb --- components/GalleryFeatured.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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'}) }, }