summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-10-20 22:48:05 +0200
committerJules Laplace <julescarbon@gmail.com>2020-10-20 22:48:05 +0200
commitb737fa9a346082459cd746b7127db4984b350c04 (patch)
tree2e9fc879d5fb2a6be91174264efe1104968a04be /animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js
parentb5aa4f3c96f9604195e30d9a81b06805b62e913e (diff)
actually scrolling to footnotes
Diffstat (limited to 'animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js')
-rw-r--r--animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js b/animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js
index fa5142f..1582d82 100644
--- a/animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js
+++ b/animism-align/frontend/app/views/viewer/sections/viewer.sections.footnotes.js
@@ -14,6 +14,9 @@ class ViewerSectionsFootnotes extends Component {
super(props)
this.scrollRef = React.createRef()
}
+ componentDidMount() {
+ this.cacheScrollPositions()
+ }
componentDidUpdate(prevProps) {
if (this.props.footnoteList !== prevProps.footnoteList) {
this.cacheScrollPositions()
@@ -30,8 +33,7 @@ class ViewerSectionsFootnotes extends Component {
}
scrollToFootnote() {
const { currentFootnote } = this.props
- const id = currentFootnote - 1
- const pos = this.state.scrollPositions[id]
+ const pos = this.state.scrollPositions[currentFootnote - 1]
this.scrollRef.current.scrollTo(0, pos - 5)
}
render() {
@@ -55,6 +57,7 @@ class ViewerSectionsFootnotes extends Component {
</div>
</div>
))}
+ <div className='note-spacer' />
</div>
<div className='nav-footnotes-gradient' />
<FootnotesLink type='down' />