Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Commit

Permalink
fix: change hash offset from getBoundingClientRect() to offsetTop
Browse files Browse the repository at this point in the history
Fixing issue which getBoundingClientRect top values to be incosistent (containing negative value).
  • Loading branch information
yongkyali committed Feb 21, 2020
1 parent 5a9f319 commit d3c000d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/functions/onEnter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const onEnter = ({
const hashElement = document.getElementById(hash)

if (hashElement) {
const clientRect = hashElement.getBoundingClientRect()
scrollTo = [0, clientRect.top]
const clientOffsetTop = hashElement.offsetTop;
scrollTo = [0, clientOffsetTop]
}
}

Expand Down

0 comments on commit d3c000d

Please sign in to comment.