Group all lightbox elements in a discussion

AI-generated summary

designbygio needs to group all .lightbox elements in a discussion to create a gallery between all images. The current issue is that lightbox.js is called for each individual post, resulting in separate image collections. To achieve this, designbygio wants to know where to call lightbox.js so it fires when the entire discussion is ready, not just each post. designbygio provided an example of the desired outcome: navigating-between-images-within-a-post.

I need to group all the .lightbox elements in a discussion.
Does someone has any idea where i should call lightbox.js in order to get fired when all the discussion is ready, not each individual post?

So far i figured out that:
Lightbox is set up in lib/lightbox.js and is called after DOM is rendered by api.decorateCooked() which just pass a callback function to addDecorator()
addDecorator has as argument, a DOM element cooked.

Lightbox.js is actually called in the context of each post replay.
Basically if in lightbox.js i do:
console.log(‘.lighbox’) i get always one or as many picture EACH SINGLE USER added to each replay.
I need instead to get ALL the image that are in the whole discussion.

So far the only place where i found lightbox.js called is in post-decoration.js, which it confuse me a little…

Can you describe what you are trying to achieve? It will help us help you :wink:

:slight_smile: yes sure. I want to create gallery between all the images in a discussion.
Like is required here: Navigating between images within a post

btw, is this a good category for questions like this one?