websitebuilder101
06-15-2010, 05:51 PM
Hello All-
I am very close to achieving the javascript function that I want using a modified Expand Collapse script. I'll try to explain what is is I am trying to achieve. On my website I would like to have certain images click-able, and when the image is clicked I would like a new image shown with text over it.
I can set it up when image1 gets clicked it goes to a different image (image2). I am having difficulty trying to get the entire image to show up with text over it. With the code below the second image doesn't show up entirely (only the part that is behind the text). I'm sure it's a simple modification but I want the second image to show up entirely regardless of the amount of text over it.
-Just an idea . . .I thought one way to do it would be to set the table row height and width to the same size of the background image (250x250) so that the entire second image would show up. It didn't seem to work but maybe I set it up wrong . . .
Thanks for the help!
Here is the code:
<table>
<tr>
<td>
<div id="on">
<a href="javascript: expandCollapse('expand', 'on');"><img src="image1.jpg" width="250" height="250"></a>
</div>
<div id="expand">
<span style="background-image: url(http://www.mysite.com/image2.jpg)" width="250" height="250">You can add a background image to your text.</span>
</div>
</td>
</tr>
</table>
I am very close to achieving the javascript function that I want using a modified Expand Collapse script. I'll try to explain what is is I am trying to achieve. On my website I would like to have certain images click-able, and when the image is clicked I would like a new image shown with text over it.
I can set it up when image1 gets clicked it goes to a different image (image2). I am having difficulty trying to get the entire image to show up with text over it. With the code below the second image doesn't show up entirely (only the part that is behind the text). I'm sure it's a simple modification but I want the second image to show up entirely regardless of the amount of text over it.
-Just an idea . . .I thought one way to do it would be to set the table row height and width to the same size of the background image (250x250) so that the entire second image would show up. It didn't seem to work but maybe I set it up wrong . . .
Thanks for the help!
Here is the code:
<table>
<tr>
<td>
<div id="on">
<a href="javascript: expandCollapse('expand', 'on');"><img src="image1.jpg" width="250" height="250"></a>
</div>
<div id="expand">
<span style="background-image: url(http://www.mysite.com/image2.jpg)" width="250" height="250">You can add a background image to your text.</span>
</div>
</td>
</tr>
</table>