Log in

View Full Version : Advanced Lightbox 2 Help



LiquidBiohazard
07-20-2009, 05:51 PM
Hello!

I have a photography website that I am trying to get lightbox running on.

Here is a link to one of the pages: http://www.sa-photo.ca/portraits.html

What I am trying to do here is have a lightbox slideshow when you click on one of the images, and have a image rotation of the images on the page when you click on 'More Images'. When the image on the page is clicked, it loads the full size in lightbox2 and starts the slideshow. When 'More Images' is clicked at the bottom of the page, it will rotate the images shown on the page, but still be able to do lightbox2 when you click on the new image.

The problem I am having is that when you click on 'More Images', the images will rotate fine, but no longer activate lightbox2.



Here is a sample of my javascript code (portraits.js for those of you that view my HTML Source):



var gallery = new Array();
gallery[1] = new Array("abbigail_m/00","abbigail_m/01","abbigail_m/02","abbigail_m/03","abbigail_m/04","abbigail_m/05","abbigail_m/06","abbigail_m/07","abbigail_m/08","abbigail_m/09");

var rel = new Array();
rel[1] = new Array("[1]");

var image = new Array();
image1 = new Array("0");

function pickImageFrom(whichGallery,whichRel)
{
var idx = Math.floor(Math.random() * gallery[whichGallery].length);
document.write('<div id="show' + rel[whichRel] + '"><a href="images/portraits/' + gallery[whichGallery][idx] + 'a.jpg" rel="lightbox' + rel[whichRel] + '"><img src="images/portraits/' + gallery[whichGallery][idx] + '.jpg" border="0"></a></div>');
}

function slideShow(direction){
if (direction == 'next' && image1 <= gallery[1].length){image1++} if (direction == 'next' && image1 >= gallery[1].length){image1=0}
document.getElementById("show[1]").innerHTML = '<a href="images/portraits/' + gallery[1][image1] + 'a.jpg" rel="lightbox[1]"><img src="images/portraits/' + gallery[1][image1] + '.jpg" border="0"></a>'
}



Can you guys please help me figure out why the rel="lightbox[#]" attribute in my document.getElementById string is not working?

Thank you in advance :)
Dave

LiquidBiohazard
07-26-2009, 03:36 PM
Hey Guys, Just wondering if anyone has figured this out for me yet?

I just thought of something... What if I could reference the lightbox scripts in the function slideshow(direction)

How do I do that? Is there a simple way? such as document.read(lightbox.js) or something like this? My current thoughts are that when the slideShow(direction) function is used, it stops reading the lightbox functions?