mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-02 00:05:35 +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
|
||||
? this.scrollTo(elem, offset, timeout)
|
||||
: console.log(`Element not found: ${element}`) // eslint-disable-line
|
||||
if (scroll) {
|
||||
this.scrollTo(elem, offset, timeout)
|
||||
|
||||
// update browser url
|
||||
if (typeof window !== 'undefined') {
|
||||
window.history.pushState({}, null, `#${element}`)
|
||||
}
|
||||
} else {
|
||||
console.log(`Element not found: ${element}`) // eslint-disable-line
|
||||
}
|
||||
}
|
||||
|
||||
scrollTo(element, offSet = 0, timeout = null) {
|
||||
|
Loading…
Reference in New Issue
Block a user