How can I get a vertical scroll position value?

I need to use this value with wixWindow . scrollTo () function to scroll window to the same position when a user returnes back to search results from an individual item’s page. I couldn’t find any relevant reference in a Wix API documentation.

1 Like

You will need this…

import wixWindow from ‘wix-window’;

// …

wixWindow.getBoundingRect()
.then( (windowSizeInfo) => {
let windowHeight = windowSizeInfo.window.height; // 565
let windowWidth = windowSizeInfo.window.width; // 1269
let documentHeight = windowSizeInfo.document.height; // 780
let documentWidth = windowSizeInfo.document.width; // 1269
let scrollX = windowSizeInfo.scroll.x; // 0
let scrollY = windowSizeInfo.scroll.y; // 120
} );

The code works just as expected, thank you Velo-Ninja! :smiling_face: