Results 1 to 3 of 3

Thread: Image Thumbnail Viewer II – trying to add text

  1. #1
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Image Thumbnail Viewer II – trying to add text

    http://www.dynamicdrive.com/dynamici...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.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    Code:
    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):
    Code:
    <a href="#" name="Caption Goes Here" onMouseover="modifyimage('dynloadarea', 0);get_cap(this.name);">
    after the image container (example):
    HTML Code:
    <div id="dynloadarea" style="width:140px;height:225px"></div>
    put this caption container (example):
    HTML Code:
    <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.
    Last edited by jscheuer1; 03-25-2005 at 04:44 AM.

  3. #3
    Join Date
    Mar 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •