I've tried using this, and for some reason, the page is not refreshing after the first add, only after the second add, so the total is always one less than it should be.
For example, I add the first image to the lightbox, and the count remains 0. As soon as I add the second image to the lightbox, the count goes to 1, but clicking on the lightbox, there are clearly 2 images there. Any idea what is wrong? I've double and triple checked my edits, and all is correct. Using 1.7.7