Scroll to top when lightbox is closed

I have four links at the bottom of a page to different lightboxes. When you open one, and then close it, the page scrolls to the top and I would like it to stay at the bottom. Any idea how to achieve this? Thanks!

In order to do it, you’ll have to open and close the lightbox with code only.
remove the auto-close(the X or the overlay - via the lightbox settings).

And do something like:

//Parent page
import wixWindow from 'wix-window';
$w.onReady(() => {
    $w('#bottonLink1').onClick(event => {
        let y = event.clientY - event.offsetY;
        wixWindow.openLightbox('Lightbox_Name')
        .finally(() => {
        wixWindow.scrollTo(0, y, {scrollAnimation:false});
        })
    })
})
//Lightbox
import wixWindow from 'wix-window';
$w.onReady(() => {
$w('#closeButton').onClick(wixWindow.lightbox.close);
})

Great, thanks so much!

Hello J.D,

what would be the code If I want the page to be stay the same when the lightbox is closed?

I don’t want the page to be scrolled up with scrolled down, when the lightbox is closed, it just close, without scrolling to anywhere.