Expend a gallery

By clicking on an image in the gallery, instead of displaying the following image, is it possible to show other images related to the one clicked, in order to develop each of them. Let’s say that the image in the gallery is a preview of a project, by clicking on it, we can see more images related to the concerned project.
Thanks in advance for your help.