Skip to content

toVirtualScrollTop

Since v2.13.0

Translate a native scrollTop (spacer space) into a virtual scroll offset in raw row-content space. Identity when the mapping is not capped.

The result is clamped to [0, rawContentHeight - viewportHeight] so callers never index past the dataset, even when the spacer’s actual scrollable extent slightly exceeds spacerHeight - viewportHeight (e.g. when a horizontal scrollbar adds bottom padding to the faux spacer).

function toVirtualScrollTop(scrollTop: number, mapping: ScrollMapping): number
NameTypeDescription
scrollTopnumber
mappingScrollMapping
AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://toolboxjs.com/llms-full.txt