1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-02 00:05:35 +01:00

update urls on TOC click

This commit is contained in:
Matthias Kretschmann 2019-01-28 15:38:53 +01:00
parent 956fe45529
commit 7f555bbe11
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -41,6 +41,11 @@ export default class TocScroll extends React.Component {
scroll
? this.scrollTo(elem, offset, timeout)
: console.log(`Element not found: ${element}`) // eslint-disable-line
// update browser url
if (typeof window !== 'undefined') {
window.history.pushState({}, null, `#${element}`)
}
}
scrollTo(element, offSet = 0, timeout = null) {