Skip to content

Commit

Permalink
final fix for tooltip on scrolls issue #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Brandt committed Mar 29, 2013
1 parent 590a0ea commit 6917e9d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,13 @@ var Chart = function(context, tooltipOptions){
yPosition += (e.offsetTop + e.clientTop);
e = e.offsetParent;
}
xPosition -= window.pageXOffset;
yPosition -= window.pageYOffset;
if(window.pageXOffset > 0 || window.pageYOffset > 0) {
xPosition -= window.pageXOffset;
yPosition -= window.pageYOffset;
} else if(document.body.scrollLeft > 0 || document.body.scrollTop > 0) {
xPosition -= document.body.scrollLeft;
yPosition -= document.body.scrollTop;
}
return { x: xPosition, y: yPosition };
}

Expand Down

0 comments on commit 6917e9d

Please # to comment.