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

Function getMaxScrollPosition

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

Source from the content-addressed store, hash-verified

39}
40
41export function getMaxScrollPosition(
42 target: ScrollTarget,
43 direction: Direction
44): number {
45 const element = isWindow(target)
46 ? (target.document.scrollingElement ?? target.document.documentElement)
47 : target;
48
49 return direction === "vertical"
50 ? element.scrollHeight - element.clientHeight
51 : element.scrollWidth - element.clientWidth;
52}
53
54export function scrollTargetTo(
55 target: ScrollTarget | null,

Callers 1

useScrollToIndexFunction · 0.90

Calls 1

isWindowFunction · 0.85

Tested by

no test coverage detected