Better scrollTo offset

This commit is contained in:
jos 2017-01-05 15:04:39 +01:00
parent a9a453f51f
commit b256e1c8ce
1 changed files with 2 additions and 1 deletions

View File

@ -397,9 +397,10 @@ export default class TreeMode extends Component {
const name = compileJSONPointer(path)
const container = this.refs.contents
const elem = container.querySelector('div[name="' + name + '"]')
const offset = -(container.getBoundingClientRect().height / 4)
if (elem) {
jump(elem, { container, offset: -100, duration: 400 })
jump(elem, { container, offset, duration: 400 })
}
}