Using glightbox

So I have a post with 108 images. I ditched the figure shortcode I was tinkering with to re-embrace glightbox. I incorporated the latest iteration of @jsonbecker’s shortcode to take advantage of the image resizing. I created a gallery shortcode to create a flexbox container for each gallery. The post now has 11 galleries.

I vaguely remember there being glightbox hooks for styling the presentation … which I’m assuming I could dig into for tinkering with how the descriptions are displayed and whatnot.

So here’s the actually question. Whenever you enter a gallery … upon exiting you end up at the top of the page … which sucks for long pages or galleries displayed on list pages. I kinda remember that you could create named anchors to hop about a page. Sooo…

Is there already a way to resume from the link location that launched the gallery … and if not … would it be something I could tinker into existence without reinventing the wheel?

I can’t reproduce the behavior you’re describing. Can you share a link to the post in question?

In this post I end each chapter with a gallery of the source images.

I should probably also mention that I’m using iOS … been forever since I was on the laptop or desktop … I can’t recall what the experience was like there.

Update: I had totally forgotten that sometimes exiting leaves me with navigation header quirks. Maybe my theme is driving the issue somehow.

Before entering (properly decorated categories):

After exiting (projects decides it oughta light up):

I only see this on iOS, no other browser. I suspect this is a mobile Safari specific incompatibility that may exist upstream in the glightbox.js project.

1 Like

Appreciate you checking it out

After months of piddling with Hugo, I have been breaking my theme into plugins. Thought I’d share what I ended up doing with your glightbox plugin (which is basically just parameterizing the sh$t out of it to satisfy myself). I ended up piddling with open, close, and slide change events so I could inject events for Google Tag Manager. Figure if I were invested enough, it probably wouldn’t take much to store scroll position and then return it from the open and close events. Anyway, you can see what I did (and holler if I oughta include more acknowledgment or a license, I’ve only ever programmed for myself before so this sh$t hasn’t really come up): plugin-lightbox

Nice extension! I haven’t looked that close, but the acknowledgment is more than enough for me.

1 Like