calculateCenteredTarget

Slide
stable

Compute the scroll offset that places a selected slide item at the visual center of its container. Used by OrigamSlideGroup in centered-scroll mode.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

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

{selectedElement, containerElement, isHorizontal}
requis
{ selectedElement: HTMLElement containerElement: HTMLElement isHorizontal: boolean }

API

Valeur de retour

La valeur retournée par cet util.

The scroll position (in pixels) to set on the container so that the selected element appears centered.

Usage

Exemples

Extraits de code prêts à coller.

Center the active tab in a tab bar

typescript