@J. D He its me again. I was wondering if you could help me with this problem. I´m not really good with coding. Do you think you can explain how and where I’m gonna put the code? I have tried everything but I can’t understand how to do it. My email is: maxmorris0505@gmail.com
If you’re leaving the page you have to store the position first.
If the user leaves the page on clicking then you should create an onClick listener, that will run the getBoundingRect() and store it to the memory or to the browser cache, see here how to store: https://www.wix.com/corvid/reference/wix-storage.html
Thanks JD. I am on a page where a gridgallery is located. There is no click event for the gridgallery so I used viewportLeave event to store the scrollx and scrolly values.
On the same page onReady event, I tried to scroll to the values retrieved but no luck.
Sorry I am new to Corvid and java scripting, hope you can assist.
import wixWindow from ‘wix-window’; import {session} from ‘wix-storage’;
wixWindow.onReady( function () {
wixWindow.scrollTo(session.getItem(“PageScrollX”),session.getItem(“PageScrollY”));
});
export function gridGallery1_viewportLeave(event) {
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
} );