I need a way to use Shadowbox.open() to open a specified index into the array, either as an argument to Shadowbox.open(), specified with Shadowbox.current, using options or some other way you see fit.
The problem is that Shadowbox.open() resets the current var if you feed it with a gallery (Array). I need a way around this and I can't seem to find any without patching Shadowbox. I've taken this easy route in my installation:
diff -u -r shadowbox-source-3.0b.orig/shadowbox.js shadowbox-source-3.0b/shadowbox.js
--- shadowbox-source-3.0b.orig/shadowbox.js 2009-04-29 06:26:23.000000000 +0200
+++ shadowbox-source-3.0b/shadowbox.js 2009-11-08 15:15:19.000000000 +0100
@@ -742,7 +742,7 @@
* @return void
* @public
*/
- open: function(obj){
+ open: function(obj, index){
// if it's a link element, build an object on the fly
if(U.isLink(obj))
obj = S.buildCacheObj(obj);
@@ -750,7 +750,7 @@
// set up the gallery
if(obj.constructor == Array){
S.gallery = obj;
- S.current = 0;
+ S.current = index ? parseInt(index) % obj.length: 0;
}else{
if(!obj.gallery){
// single item, no gallery
Hope you find this feature useful. I personally find it cleaner to programmatically work with gallery content rather than clutter and parse existing html to look for links, inline html and whatnot.
Patch attached, if interested.
shadowbox-3.0b-open_index.diff