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
Full TypeScript signature sourced from the util file.
API
Parameters
Input parameters accepted by this util.
- {selectedElement, containerElement, isHorizontal}required{ selectedElement: HTMLElement containerElement: HTMLElement isHorizontal: boolean }
API
Return value
The value returned by this util.
- The scroll position (in pixels) to set on the container so that the selected element appears centered.
Usage
Examples
Ready-to-paste usage snippets.
Center the active tab in a tab bar