Skip to content

Commit 0963c8f

Browse files
jung35simonbrunel
authored andcommitted
Fix positioning in the custom tooltip example (#5454)
1 parent 119a86f commit 0963c8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/configuration/tooltip.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,13 @@ var myPieChart = new Chart(ctx, {
256256
// Display, position, and set styles for font
257257
tooltipEl.style.opacity = 1;
258258
tooltipEl.style.position = 'absolute';
259-
tooltipEl.style.left = position.left + tooltipModel.caretX + 'px';
260-
tooltipEl.style.top = position.top + tooltipModel.caretY + 'px';
259+
tooltipEl.style.left = position.left + window.pageXOffset + tooltipModel.caretX + 'px';
260+
tooltipEl.style.top = position.top + window.pageYOffset + tooltipModel.caretY + 'px';
261261
tooltipEl.style.fontFamily = tooltipModel._bodyFontFamily;
262262
tooltipEl.style.fontSize = tooltipModel.bodyFontSize + 'px';
263263
tooltipEl.style.fontStyle = tooltipModel._bodyFontStyle;
264264
tooltipEl.style.padding = tooltipModel.yPadding + 'px ' + tooltipModel.xPadding + 'px';
265+
tooltipEl.style.pointerEvents = 'none';
265266
}
266267
}
267268
}

0 commit comments

Comments
 (0)