Target class and element within same animation


I am looking for a way to target “class” and “selected element” for the same element within 1 animation. Is there a way to do it?

I have a gallery with images. When clicking on an image I want to display details to that item.
Currently my images stack on top of each other. With my animation I want to hide details for the class to make sure the area is empty when clicking on another element. Afterwards I only want to display the clicked detail div.

Here is my public share link: LINK
(how to access public share link)