diff --git a/public/app/core/jquery_extended.ts b/public/app/core/jquery_extended.ts index 11c67be9656..36d6d44c0d3 100644 --- a/public/app/core/jquery_extended.ts +++ b/public/app/core/jquery_extended.ts @@ -42,8 +42,11 @@ $.fn.place_tt = (() => { width = $tooltip.outerWidth(true); height = $tooltip.outerHeight(true); - $tooltip.css('left', x + opts.offset + width > $win.width() ? x - opts.offset - width : x + opts.offset); - $tooltip.css('top', y + opts.offset + height > $win.height() ? y - opts.offset - height : y + opts.offset); + const left = x + opts.offset + width > $win.width() ? x - opts.offset - width : x + opts.offset; + const top = y + opts.offset + height > $win.height() ? y - opts.offset - height : y + opts.offset; + + $tooltip.css('left', left > 0 ? left : 0); + $tooltip.css('top', top > 0 ? top : 0); }); }; })();