MCPcopy
hub / github.com/stutrek/scrollmonitor / getContentHeight

Function getContentHeight

src/container.ts:19–37  ·  view source on GitHub ↗
(element: HTMLElement)

Source from the content-addressed store, hash-verified

17}
18
19function getContentHeight(element: HTMLElement) {
20 if (isOnServer) {
21 return 0;
22 }
23
24 if (element === document.body) {
25 // jQuery approach
26 // whichever is greatest
27 return Math.max(
28 document.body.scrollHeight,
29 document.documentElement.scrollHeight,
30 document.body.offsetHeight,
31 document.documentElement.offsetHeight,
32 document.documentElement.clientHeight
33 );
34 } else {
35 return element.scrollHeight;
36 }
37}
38
39function scrollTop(element: HTMLElement) {
40 if (isOnServer) {

Callers 3

constructorMethod · 0.85
calculateViewportMethod · 0.85
updateStateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected