PDA

View Full Version : Image Thumbnail Viewer II trying to add text



Smifffy
03-25-2005, 12:42 AM
http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm
I am pretty new to web design and attempting to design my first site. This script is a brilliant thumbnail viewer but is it possible to display a text description as well as the main image each time the mouse rolls over a different thumbnail. How would I change the code to do this?

Please Help.

jscheuer1
03-25-2005, 04:34 AM
I'm just getting my feet wet looking at the code and it occurs to me to ask, where do you want this 'text description' to appear? To that end, if you have a page on the web where you are working this out, that would help as well. A simple:

title="Text Description"

attribute in the thumbnail image tag may be all you need. But, if you want a caption for the large image, try this:

add this function at the end of the script:


function get_cap(cap){
if (document.getElementById){
document.getElementById('caploadarea').innerHTML=cap;}
else if (document.all){
document.all('caploadarea').innerHTML=cap;}
else{
return;}
}modify the HTML in the form like this (changes in red):

<a href="#" name="Caption Goes Here" onMouseover="modifyimage('dynloadarea', 0);get_cap(this.name);">after the image container (example):

<div id="dynloadarea" style="width:140px;height:225px"></div>put this caption container (example):

<div id="caploadarea" style="width:140px;height:2em;text-align:center"></div>notice how the width's are the same, this is to give a nice centered look to the caption.

Smifffy
03-25-2005, 10:07 AM
Sorry for not making it clear where I needed to put the text (gone midnight when I posted the thread). I wanted to put a caption at the bottom of each main image. The code you submitted is perfect for what I want.
Many, Many, Many thanks
Smifffy.