Shadowbox.open gallery

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Shadowbox.open gallery

Cykaos
I have a page full of thumbnails that are all in the same gallery. I want to be able to auto load a particular image in the gallery so when page finishes loading the specified image will open up, and in the navigation bar it will show the correct number and have the navigation controls.

So http://mydomain.com/photo.php?album2 will take you to album 2 with all the thumbnails in album2 all in the same shadowbox gallery. No problem there.

I want http://mydomain.com/photo.php?album2&pic3 to take you to album 2 etc but I want shadowbox to open up the third pic in the gallery automatically when the page is loaded and then it will say pic 3 of 50 or whatever and the previous button will take you to pic 2 and the next will take you to pic 4.

There is my problem. I have tried several methods with none doing what I want. I tried loading a blank image with shadowbox.open and then using the change() funtion to take me to pic 3 of the gallery. This worked but it screwed up the numbering adding one extra blank image to the gallery list So instead of 3 of 50 it was 3 of 51 and using the navigation one of the images was of course blank. At least though pic 3 was in the right spot and the foward/backward buttons worked right.

I also tried just opening up the correct image in the content part of the shadowbox.open with the right gallery value. This would open that image as 1 of 51 and then the same image would be repeated again at image 3.

I haven't figured out a way to open up image 3 in the right spot in the gallery without adding extra images and screwing up the order.

Anyone have any ideas? I know how to get the &pic variable from the url in javascript and I know how to find the right image and title etc with my php script. I just now need to be able to open that image in the right spot on page load.
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox.open gallery

Wizzud
This might help ... http://www.nabble.com/handleOversize-and-manual-initialization-to18356847.html

Instead of using ids, you might want to use a library's capability to find the nth element of a set,and pass that element into open(), eg

jQuery:

var nth = 4; //calculated from url, presumably, and zero-based
Shadowbox.init(); // supply options as required
Shadowbox.open($('#gallery img').get(nth)); //amend selector as appropriate for the page

Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox.open gallery

Cykaos
Thank you. I can't believe I didn't think of just using Shadowbox.open(document.getElementById('idhere'));

It works great.