You mean like a lightbox? If so, I use Lightbox 2: https://lokeshdhakar.com/projects/lightbox2/
I used to use this, https://kmclaude.tumblr.com/post/700509209126633472 or Nanogallery2 because it's easy: https://nanogallery2.nanostudio.org/
Mr kyle neocities did smth weird and now the thumbnails are 1) random 2) evil...
Thank you