Thanks for the suggestion, yes that looks like a useful tool. However, I have examined the structure using Safari's developer elements view and my solutions was as follows:
* find all img tags within the div tag containing the gallery (sv_div.getElementsByTagName("img"))
* look through and find the visible ones
* you then have two or three. Three if you are anywhere within the gallery and two if at the beginning and the end.
* If you see two visible images, then the first of the visible images is the current image (see below)
* If you see three, then the 2nd image, the middle image is the visible image
* Any other number and you're on the thumbnail view
So I had hoped to determine when at two images if you were at the beginning or the end, but I'd probably need firebug for this or some more educated guess work. I've solved this by always adding a duplicate of the last image to the end of the gallery. It's not an ideal solution, but it works, otherwise you cannot 'select' the last image.
I had hoped to look at the offsetLeft position for the img tags but they are identical, so I presume they sit in a div that is offscreen left and right and comparing these positions would allow me to infer that, yes, img 0 is on screen (at the beginning) or no it's img 1 (the last img in the gallery).
Of course if your thumbnail view can ever show only two or three images, then this somewhat falls down there as well, so I'll probably have to look to see if the width and height of the first img are the same, as my images are not square, but the thumbnails are.
It's all a bit hacky, but it seems to work reasonably well enough. That said, some means of identifying the current image for the non-flash view would be greatly appreciated!!
Thanks a lot
Last edited by IanH (2011-06-08 09:00:17)