From ae8b7ae02d25946050a5c55a3325b13e62de7090 Mon Sep 17 00:00:00 2001 From: Doron Pagot Date: Tue, 20 Sep 2016 14:28:35 +0300 Subject: [PATCH] Use node parent when calculating offset --- example/src/index.js | 8 +++++--- src/utils/getPosition.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/example/src/index.js b/example/src/index.js index 37a4f74ab..55607bbed 100755 --- a/example/src/index.js +++ b/example/src/index.js @@ -45,7 +45,7 @@ const Test = React.createClass({

React Tooltip

-
+
◕‿‿◕ @@ -83,7 +83,9 @@ const Test = React.createClass({
- +
+ +
@@ -251,4 +253,4 @@ const Test = React.createClass({ } }) -render(, document.getElementById('main')) \ No newline at end of file +render(, document.getElementById('main')) diff --git a/src/utils/getPosition.js b/src/utils/getPosition.js index e84e294a2..be43b941f 100644 --- a/src/utils/getPosition.js +++ b/src/utils/getPosition.js @@ -24,7 +24,7 @@ export default function (e, target, node, place, effect, offset, countTransform) const windowWidth = window.innerWidth const windowHeight = window.innerHeight - const {parentTop, parentLeft} = countTransform && getParent(target, countTransform) || {parentTop: 0, parentLeft: 0} + const {parentTop, parentLeft} = countTransform && getParent(node, countTransform) || {parentTop: 0, parentLeft: 0} // Get the edge offset of the tooltip const getTipOffsetLeft = (place) => {