I'm working on a layout featuring overlapping images and I'm looking to create a hide-and-seek effect where the images are hidden one by one when clicked, and then shown in reverse order until all of them are visible again – essentially creating a loop.
Currently, I have some simple code that hides the images upon clicking, but I'm struggling to figure out how to show them again. Here is the snippet:
$('.overlap-img').on("click", function() {
$(this).hide();
})
Is there a solution for achieving this effect? It doesn't necessarily need to be limited to hiding the image you click on; it could involve closing all images when any part of the layout is clicked for more control over the sequence.
Thank you for your assistance!