That's probably because there is no easy resolution.
You're trying to activate a gallery without letting Shadowbox know about that gallery's constituent parts
until you want to display an item within that gallery as part of the entire gallery.
You need to find a way for a single click on one area element (of the gallery) to initiate a build of an array of Shadowbox-cache-like objects, each object completely representing an item of the associated gallery, then pass that array into Shadowbox.open()....
- pick a valid attribute - an alternative to rel - for use with the area tag
- use it to store your rel-equivalent string (per area tag)
- set onclick to point to a handler function passing
this- in the onclick handler
- find all other constituents for the gallery
- build a cache object, for each item of the gallery, including the clicked element, using the stuff from the alternate attribute (or a rel attribute if its a standard anchor within the same gallery?)
- call open(), passing in the constructed array of cache objects
You still have a problem though. In a normal gallery, the clicked-on item appears in its rightful place in the order the gallery is presented in. When using open() with an array of cache objects, the initial presentation is the first item in the array. So, unless you arrange your cache objects such that the clicked-on element is first in the array regardless of its proper position in the gallery, the first item shown may not be the one clicked on. Trouble is, if you do rearrange the items so that the clicked-on one comes first, you are presenting the gallery in a different order each time a different item of the gallery is clicked on!
Another problem is mixing rel-attribute anchors with these area tags in the same gallery. With Shadowbox not knowing about the area elements, how do you get them to show up in a gallery initiated by a click on an anchor that Shadowbox
does know about?
My suggestion : forget about onclick/Shadowbox.open(); just set up the elements as documented and let Shadowbox handling the clicking, you'll have less headaches!
Combine literacy with curiosity and a whole world of information opens up to you