Back to same Y-coordinate using Pro Gallery?

My dynamic gallery page (https://www.kennethwinston.com/kenneth-winston-all-styles) goes to a dynamic product detail page. But when the user goes back to the gallery, (either using a button via wixLocation.to or the browsers back action) it just spits the user to the top of the page.

I understand this could easily accomplished with an onItemClicked (where the user’s Y coordinate is saved to session) but… as we all know the Pro Gallery’s onItenClicked features are not working.

Any other ideas? Work Arounds?

If you have got it setup to go back to the gallery via a button or a ‘back to gallery’ text link for example, then why can you not just set either of these links to go back to a specific anchor point on that page and not just simply back to the page itself.

The gallery is dynamic, so the page just keeps extending depending on how many styles it pulls up. The anchors are static, and I cant place it “down the page” since there’s no page to set it.

The solution is simple… if onItemClicked actually works for Pro Galleries, here’s the solution if you’re using a regular non-pro gallery:

When a gallery item is clicked:
wixWindow.getBoundingRect()
.then ((windowSizeInfo)=>{
let scrollX = windowSizeInfo.scroll.x;
let scrollY = windowSizeInfo.scroll.y;
session.setItem(‘galleryScrollY’, scrollY);
session.setItem(‘galleryScrollX’, scrollX);

}); 

When the gallery page loads “back” from the product page:
if (session.getItem(‘galleryScrollY’)) {
let scrollX = 0;
let scrollY = 0;
scrollX = Number(session.getItem(‘galleryScrollX’));
scrollY = Number(session.getItem(‘galleryScrollY’));

wixWindow.scrollTo(0, scrollY); 


session.setItem('galleryScrollX',0); 
session.setItem('galleryScrollY',0); 

}