Jump to content

implementing lightbox with java script getting wrong image


deansaddigh

Recommended Posts

i have this code for displaying pictures big and small.

 

Now i have added a the first link in here

            <div class='mainPhoto'><a href = "admin/images/properties/<?=$imagesResults[0]{'large'}?>" rel="lightbox" ><img src='admin/images/properties/<?=$imagesResults[0]{'main'}?>'  width='299px' height='189px' name="large"></a></div>
        

 

the image when you click on any of there others just shows the same image.

 

I think i need to change some java script.

 

<script language="JavaScript"><!--
//thumbnail script
$(document).ready(function(){

<? 
$y = 1;
   	foreach ($imagesResults as $imageData)
   	{
?>
	image<?=$y?> =new Image();

<?   		$y++; 
   	}
?>


// This defines the source of the display image 

<? 
$i = 1;
   	foreach ($imagesResults as $imageData1)
   	{
?>		

	image<?=$i?>.src ="admin/images/properties/<?=$imageData1{'large'}?>"
<?   		$i++; 
   	}
?>

// This defines the source of the preview image 


<? 
$r = 1;
  	foreach ($imagesResults as $imageData2)
   	{
?>		document.images['pimage<?=$r?>'].src=image<?=$r?>.src;
<? 		 $r++; 
   	}
?>
})
// This defines what to do when an image is clicked on 
function image_click(clicks)
{
<? 


$x = 1;
  	foreach ($imagesResults as $imageData3)
   	{
?>		if(clicks==<?=$x?>){document.images['large'].src=image<?=$x?>.src;}

<? 		 $x++; 
   	}
?>
}

// --></script>

 

Can anyone point me in the right direction if you go here and click on any of the smaller images then click on the main image no matter what smaller image you have selected the bigger one is always the same.

 

http://www.dhcottages.co.uk/testsite/details.php?id=75

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.