How do I make a lightbox scroll to an anchor when closed?

I’m trying to figure out this exact thing, but I don’t know where to input this code? Did you put this on the lightbox itself, or on the page? I have a gallery that I want to use to open a lightbox, then show more images inside the lightbox, then close that and allow people to select other images in the gallery. But when I close the lightbox now it jumps to the top of the page. Your site seems to work great now, so I’m sure I’m just missing something on getting this to work. Thanks for any assistance.