From 52312e28fd7b976f784e44575e3e7b3793a5c575 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Mon, 7 Jan 2013 18:15:02 -0500 Subject: [PATCH] Fix relative positioned tooltips. Fixes #319 --- js/lib/bootstrap-tooltip.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/js/lib/bootstrap-tooltip.js b/js/lib/bootstrap-tooltip.js index 5ade4b300..2f222f40a 100644 --- a/js/lib/bootstrap-tooltip.js +++ b/js/lib/bootstrap-tooltip.js @@ -155,12 +155,22 @@ }; function getPosition(node) { - return { - x: node.offsetLeft, - y: node.offsetTop, - w: node.offsetWidth, - h: node.offsetHeight - }; + var mode = d3.select(node).style('position'); + if (mode === 'absolute' || mode === 'static') { + return { + x: node.offsetLeft, + y: node.offsetTop, + w: node.offsetWidth, + h: node.offsetHeight + }; + } else { + return { + x: 0, + y: 0, + w: node.offsetWidth, + h: node.offsetHeight + }; + } } })(this);