getOverflow

Commons
stable

Calculates how much box a overflows box b on each side (before/after on both axes). Returns zero for sides where a is fully contained inside b.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

a
requis
IBox
The potentially overflowing box (e.g. a floating overlay or tooltip).
b
requis
IBox
The bounding container box (e.g. the viewport or a scroll container).

API

Valeur de retour

La valeur retournée par cet util.

An object with x and y axes, each containing before (left/top overflow) and after (right/bottom overflow) amounts in pixels. Values are ≥ 0.

Usage

Exemples

Extraits de code prêts à coller.

Check if a tooltip overflows the viewport

typescript