frontend: avoid scrolling too soon when switching pages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d9a5bcdd54
commit
021476bfa2
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div class="reader" v-shortkey="{next: ['arrowleft'], prev: ['arrowright']}" @shortkey="navigation" :style="{ 'grid-template-columns': showSidebar ? 'auto 250px' : 'auto' }">
|
||||
<div>
|
||||
<img :style="{ width: pageWidth + '%' }" :src="info.pages[page]">
|
||||
<img :style="{ width: pageWidth + '%' }" :src="info.pages[page]" @load="setScroll">
|
||||
<!-- prefetching -->
|
||||
<img style="display: none;" :src="info.pages[page-1]">
|
||||
<img style="display: none;" :src="info.pages[page+1]">
|
||||
|
@ -56,7 +56,9 @@ export default {
|
|||
if (page >= 0 && page < this.info.pages.length) {
|
||||
this.$router.push({ query: { page: page + 1 } })
|
||||
}
|
||||
},
|
||||
|
||||
setScroll () {
|
||||
// load saved scroll posotion, if available, reset to 0 otherwise
|
||||
if (this.scrollPositions[this.page]) {
|
||||
window.scrollTo(0, this.scrollPositions[this.page])
|
||||
|
|
Reference in a new issue