smooth scrolling to featured thumb

This commit is contained in:
ManjaroOne666 2019-01-28 12:17:43 +00:00
parent 40cf497c5e
commit 05fd4e9792
1 changed files with 5 additions and 1 deletions

View File

@ -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'})
},
}
</script>