If I want to track, say, 80 images, not at the same time, but only show content when there is only 1 of them in view (they are pretty close to eachother). How would I go about that? If there are 4 (or 2 or 68) in view, I don’t want to show anything and I don’t want to auto-select the first one it finds (which is what would happen if using the posted code I guess). Using a loop to look for target images and keeping count of them could be a way to go, but that might get too slow and unstable.
In the same case, could I maybe force my user to get closer to 1 of the targets by setting some kind of minimum-size of the target to trigger any content? If you’re far away from it, the target might be 5% screen size, and I want it to trigger when it’s at least 50% screen size (this gives me only 2/3/4 targets in viewport at the same time, which could work with a loop to check how many are in view).