Skip to content

Commit

Permalink
Do not apply body offset if the body element doesn't have any position.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnsk committed Jan 4, 2018
1 parent e997a31 commit 578cdad
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ export function removeHtmlTags (text) {
}

export function getBodyOffset () {
// Do not return offset if the body element doesn't have any position.
if (document.body.style.position === 'static' ||
document.body.style.position === '') {
return { top: 0, left: 0 };
}

const rectBody = document.body.getBoundingClientRect();
const rectDocument = document.documentElement.getBoundingClientRect();

Expand Down

0 comments on commit 578cdad

Please sign in to comment.