I am currently working on a project where I have a series of images with captions that appear underneath each one. To show or hide the caption for each image, I am using slideToggle when the image is clicked.
$('.imageholder').click(function() {
$(this).next().slideToggle("fast");
});
If you want to see this method in action, feel free to check out my code snippet here.
While my current implementation works well, I am facing an issue where multiple captions can be visible at the same time. Ideally, I would like to only allow one caption to be displayed at any given moment. When a user clicks on an image, any open captions should automatically close.
If anyone could provide some guidance on how to achieve this desired behavior, I would greatly appreciate it. Thank you!