Results 1 to 10 of 10

Thread: Thumbnailviewer2: create additional command to set caption in specific div?

  1. #1
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thumbnailviewer2: create additional command to set caption in specific div?

    1) Script Title: Thumbnailviewer2

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...thumbnail2.htm

    3) Describe problem: I would like to create an additional command which tells each thumbnail to send a caption to a specific div id on mouseover. It would be similar to what the script is doing already: sending a command from each thumbnail to a larger image on mouseover, except it would be for text, and it would be in addition to this command. I know the script allows for a "title" to be inputted, but it only lets you display it under the image, and it can't really be styled. A friend of mine has a hunch that what needs to be done is find a javascript function that sets an element based on its id? Help!

    Here is a link to a page that I'm working on. The caption is in the bottom right corner of the page, and the image is on the left.

    http://corakim.webs.com/dolls.html

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    One approach is to modify the script so the title attribute of the image, apart from being shown beneath the enlarged image, is also shown inside a specific DIV of your choice on the page. To do this, inside the .js file, add the additions in red:

    Code:
    if (description!=""){ //Use title attr of the link as description?
    imageHTML+='<br />'+description
    document.getElementById("mydesc").innerHTML=description
    }
    This assumes "mydesc" is a blank DIV on your page with that ID.
    DD Admin

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

    Or more to the point, in this case I think, instead of being shown beneath the enlarged image:

    Code:
    if (description!=""){ //Use title attr of the link as description?
    document.getElementById("mydesc").innerHTML = description;
    }
    Which (as in DD's version) will show the description in a division with that id anywhere on the page, example HTML code for that division:

    HTML Code:
    <div id="mydesc"></div>
    The only difference being that with my suggestion the image itself will not have a description showing directly below it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you so much! That worked perfectly! The only thing that I'm kind of being finicky about...(although it is really a minor detail) is that by using the title attribute you also get a little yellow boxed caption that pops up next to the thumbnail if you hover your mouse over it long enough. Is there a way to hide that box?

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

    For most browsers, yes. Put an empty title attribute for the thumbnail, ex:

    Code:
    <a title="Neat Doll, some stuff about this doll" class="thumbs1" href="/dolls/doll640x433.jpg" rel="enlargeimage::mouseover" rev="image">
    <img title="" src="/dolls/doll.jpg" alt="" width="50" height="50" /></a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Apr 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Captions

    I'm also trying to add captions to my enlarged photos using the thumbnailviewer2.js file. I added the segments of code posted here, but something tells me I don't have all of the code... :/

    Any help would be great.

    Thanks

  7. #7
    Join Date
    Apr 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nevermind! I'm stupid! I got it haha

    Thanks anyway :P

  8. #8
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default i'm ok with being stupid, please just help me

    I need the same help that the other folks in this post needed, only I can't figure out where the modified code goes because according to the documentation the code was rewritten since this solution was posted and thus I'm lost as to my point of entry. please help.
    Last edited by heidipeyser; 02-26-2011 at 07:02 AM.

  9. #9
    Join Date
    Jun 2012
    Posts
    7
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Is this solution still applicable?

    I know this is an older thread, but I do need this solution as well. But looking through the code it seems like the code has changed since the solution was posted. Is that so? If so how could this be done with the newer code? Or am I just missing something?

  10. #10
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Please start a new thread for this question.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

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
  •