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

Commit e063e6d

Browse files
committed
Merge pull request #47 from 720kb/revert-40-patch-1
Revert "Make tooltip offsets relative to the viewport"
2 parents b4d5738 + 9063281 commit e063e6d

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/js/angular-tooltips.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,24 @@
102102
}
103103
};
104104

105-
$scope.getRootOffsetTop = function getRootOffsetTop (elem){
106-
return elem.getBoundingClientRect().top;
105+
$scope.getRootOffsetTop = function getRootOffsetTop (elem, val){
106+
107+
if (elem.offsetParent === null){
108+
109+
return val + elem.offsetTop;
110+
}
111+
112+
return $scope.getRootOffsetTop(elem.offsetParent, val + elem.offsetTop);
107113
};
108114

109-
$scope.getRootOffsetLeft = function getRootOffsetLeft (elem){
110-
return elem.getBoundingClientRect().left;
115+
$scope.getRootOffsetLeft = function getRootOffsetLeft (elem, val){
116+
117+
if (elem.offsetParent === null){
118+
119+
return val + elem.offsetLeft;
120+
}
121+
122+
return $scope.getRootOffsetLeft(elem.offsetParent, val + elem.offsetLeft);
111123
};
112124

113125
$scope.bindShowTriggers = function() {

0 commit comments

Comments
 (0)