Position and show a pre-built tooltip element near the given anchor.
The tooltip is appended to document.body with absolute positioning.
It is placed below the anchor by default, but flips above if there
is not enough viewport space below. Horizontal position is clamped
to keep the tooltip within the viewport.
Any previously active tooltip is hidden first.
Parameters
anchor: HTMLElement
The element the tooltip is anchored to.
tip: HTMLElement
The tooltip element to show (will be mutated in place).
Position and show a pre-built tooltip element near the given anchor.
The tooltip is appended to
document.bodywith absolute positioning. It is placed below the anchor by default, but flips above if there is not enough viewport space below. Horizontal position is clamped to keep the tooltip within the viewport.Any previously active tooltip is hidden first.