MCPcopy Create free account
hub / github.com/bvaughn/react-window / getScrollPosition

Function getScrollPosition

lib/utils/scrollElement.ts:30–39  ·  view source on GitHub ↗
(
  target: ScrollTarget,
  direction: Direction
)

Source from the content-addressed store, hash-verified

28}
29
30export function getScrollPosition(
31 target: ScrollTarget,
32 direction: Direction
33): number {
34 if (isWindow(target)) {
35 return direction === "vertical" ? target.scrollY : target.scrollX;
36 }
37
38 return direction === "vertical" ? target.scrollTop : target.scrollLeft;
39}
40
41export function getMaxScrollPosition(
42 target: ScrollTarget,

Callers 2

useScrollToIndexFunction · 0.90
useVirtualizerFunction · 0.90

Calls 1

isWindowFunction · 0.85

Tested by

no test coverage detected