Const
Gets the current scroll position of the viewport.
Returns x (horizontal) and y (vertical) scroll positions in pixels. Uses cross-browser compatible methods to retrieve scroll position.
Operation data with scrollX and scrollY values
scrollX
scrollY
// Get current scroll positionconst result = getScrollPosition({});// result.scrollX = 150// result.scrollY = 400 Copy
// Get current scroll positionconst result = getScrollPosition({});// result.scrollX = 150// result.scrollY = 400
Gets the current scroll position of the viewport.
Returns x (horizontal) and y (vertical) scroll positions in pixels. Uses cross-browser compatible methods to retrieve scroll position.