...

View Full Version : PHP while loop problem



Ryan55
04-11-2012, 01:43 PM
Hey,

I have the following code:


while($assoc3 = $db->assoc($query3))
{

//Displays photos
echo "<a href='#' class='lightbox'><img src='".$assoc3[img_location]."' width='100' height='100' style='margin:5px' /></a>";

//Open lightbox (PROBLEM)
echo "<div class='backdrop'></div><div class='box'><div class='close'>x</div><img src='".$assoc3[img_location]."' width='100' height='100' /></div>";

}

which loops though the database and all the thumbnails of pictures in an album. However when I add the code to open a lightbox because its in the loop in the lightbox I get all the pictures instead of just the one I clicked on. How can I make it so that it only displays the picture I clicked on in the lightbox?

Thanks

mlseim
04-11-2012, 02:15 PM
Doesn't lightbox have the "image set" feature where you
have to put something like this for each <a href> tag?
rel="lightbox[photos]"

http://lokeshdhakar.com/projects/lightbox2/

What "lightbox" are you using? JQuery?

Ryan55
04-11-2012, 02:21 PM
Yeah I am using jQuery but not the lightbox from the link you have

mlseim
04-11-2012, 02:29 PM
Give us the link to the script you are using.
I still think you have missing things that relate to the lightbox javascripting.

Ryan55
04-11-2012, 05:23 PM
The script I am using is here:

http://www.tonylea.com/2011/how-to-create-your-own-jquery-lightbox/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum