mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
only update url if element exists
This commit is contained in:
parent
8923f35d00
commit
942106b88c
@ -37,14 +37,16 @@ export default class TocScroll extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scroll
|
if (scroll) {
|
||||||
? this.scrollTo(elem, offset, timeout)
|
this.scrollTo(elem, offset, timeout)
|
||||||
: console.log(`Element not found: ${element}`) // eslint-disable-line
|
|
||||||
|
|
||||||
// update browser url
|
// update browser url
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window !== 'undefined') {
|
||||||
window.history.pushState({}, null, `#${element}`)
|
window.history.pushState({}, null, `#${element}`)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`Element not found: ${element}`) // eslint-disable-line
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollTo(element, offSet = 0, timeout = null) {
|
scrollTo(element, offSet = 0, timeout = null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user