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