Skip to content
This repository was archived by the owner on Mar 17, 2020. It is now read-only.

Commit 603dd1c

Browse files
author
Justin Palmer
committed
Merge pull request #28 from Caged/scroll-offsets-fix
Use documentElement as the default for scroll offsets
2 parents ad4d927 + 41e140a commit 603dd1c

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,9 @@ d3.tip = function() {
246246
height = tbbox.height,
247247
x = tbbox.x,
248248
y = tbbox.y,
249-
scrollTop = document.body.scrollTop,
250-
scrollLeft = document.body.scrollLeft
249+
scrollTop = document.documentElement.scrollTop || document.body.scrollTop,
250+
scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft
251251

252-
if(document.documentElement && document.documentElement.scrollTop) {
253-
scrollTop = document.documentElement.scrollTop
254-
scrollLeft = document.documentElement.scrollLeft
255-
}
256252

257253
point.x = x + scrollLeft
258254
point.y = y + scrollTop

0 commit comments

Comments
 (0)