UNPKG

web-collect-events-narayana

Version:

An sdk for collecting events from web pages

24 lines (21 loc) 829 B
export default function getScrollState(): Record<string, any> { const scrollState: Record<string, any> = {}; // Retrieve scroll-related information scrollState.scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop; scrollState.scrollLeft = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft; scrollState.scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; scrollState.scrollWidth = document.documentElement.scrollWidth || document.body.scrollWidth; scrollState.clientHeight = document.documentElement.clientHeight || document.body.clientHeight; scrollState.clientWidth = document.documentElement.clientWidth || document.body.clientWidth; return scrollState; }