In the example you posted:
https://jsbin.com/zogubiveye/edit?html,output
The behaviour just seems really odd and janky, after resizing the window vertically or toggling the thumbnails, you have to zoom in and zoom out to get it to position optimally.
Also, a more desirable option would be something akin to object-fit: contain.
I want the image to expand to fit inside the container's edges but not outside.