Jump to content

why doesn't my background image stay


php_beginner_83

Recommended Posts

Hi All

 

I'm having a problem getting the background image of a <div> to stay.  What I'm trying to do is when a user clicks on a thumbnail of an image a larger version of the thumbnail will be displayed on the same page.  This works no problem.  Depending on whether the image is landscape or portrait, I want to change the background image.  It works but after a few seconds it goes back to the original background image.  However, instead of having the link on an image(my thumbnails) when I put the code on text it works and the background sticks.

 

Does anyone have any idea what's going on or how I can solve this??  :confused:

 

Thank you.

 

This is my php code with the link on the thumbnail....Using this the background image will change but then quickly go back to the original background image.

 

	echo "<a href=\"".$_SERVER['SCRIPT_NAME']."?page=photo&img=".($dimarray[$i][1])."&ID=".$albumID."\" 
	onclick=\"changeBGImage()\">" . "<img src=\"" . $thumbDir . "/" . $paths[$i] . "\" alt=\"" . $paths[$i] . "\" />\n";
		echo "   </a>\n";

 

However, when I use this code the background image changes and stays...

 

		echo '<a href="#" onclick="changeBGImage(\'background\')">shanna</a>';

 

Is there any other code you would need to see??

Link to comment
https://forums.phpfreaks.com/topic/186878-why-doesnt-my-background-image-stay/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.