when window scroll, the tooltip show incorrect position coz its missing offset of window.scrollXY

This commit is contained in:
Toan
2020-06-11 15:59:02 +07:00
parent 6e13718cbd
commit 44675739a1
2 changed files with 5 additions and 4 deletions

View File

@@ -272,8 +272,8 @@ const setupToolTips = function(element) {
.style('opacity', '.9');
tooltipElem
.html(el.attr('title'))
.style('left', rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', rect.top - 14 + document.body.scrollTop + 'px');
.style('left', window.scrollX + rect.left + (rect.right - rect.left) / 2 + 'px')
.style('top', window.scrollY + rect.top - 14 + document.body.scrollTop + 'px');
el.classed('hover', true);
})
.on('mouseout', function() {