MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / scrollToTop

Function scrollToTop

packages/utilities/src/scroll.ts:14–25  ·  view source on GitHub ↗
(node: HTMLElement, smooth?: boolean)

Source from the content-addressed store, hash-verified

12}
13
14export function scrollToTop(node: HTMLElement, smooth?: boolean) {
15 if (node) {
16 if (node.scroll && smooth) {
17 node.scroll({
18 top: 0,
19 behavior: 'smooth',
20 });
21 } else {
22 node.scrollTop = 0;
23 }
24 }
25}
26
27const SCROLL_AT_BOTTOM_TOLERANCE = 3;
28

Callers 1

handleScrollFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected