Results 1 to 3 of 3

Thread: Thumbnail viewer modification troubles

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

    Default Thumbnail viewer modification troubles

    1) Script Title: image thumbnail viewer

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/thumbnail.htm

    3) Describe problem: Hi, I've been using the script for a couple of days and it works great but when I have a particularly long description for an image, it makes the box very wide, sometimes wider than the window -cutting off some of the text as a result. I know there is probably a simle thing to do to specify the max width of description but I'm not sure how. Can anyone provide the code that I should insert into the script? Many thanks!

  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

    In the script, replace the loadimage:function(link) with this one:

    Code:
    loadimage:function(link){ //Load image function that gets attached to each link on the page with rel="thumbnail"
    if (this.thumbBox.style.visibility=="visible") //if thumbox is visible on the page already
    this.closeit() //Hide it first (not doing so causes triggers some positioning bug in Firefox
    var imageHTML='<img src="'+link.getAttribute("href")+'" style="'+this.opacitystring+'" />' //Construct HTML for shown image
    if (this.enableTitle && link.getAttribute("title")) //Use title attr of the link as description?
    imageHTML+='<br />'+link.getAttribute("title")
    this.centerDiv(this.thumbLoading) //Center and display "loading" div while we set up the image to be shown
    this.thumbImage.innerHTML=imageHTML //Populate thumbImage div with shown image's HTML (while still hidden)
    this.featureImage=this.thumbImage.getElementsByTagName("img")[0] //Reference shown image itself
    if (this.featureImage.complete){
    this.thumbImage.style.width = this.featureImage.width + 'px';
    thumbnailviewer.showthumbBox()
    }
    else{
    this.featureImage.onload=function(){ //When target image has completely loaded
    thumbnailviewer.thumbImage.style.width = thumbnailviewer.featureImage.width + 'px';
    thumbnailviewer.showthumbBox() //Display "thumbbox" div to the world!
    }
    }
    if (document.all && !window.createPopup) //Target IE5.0 browsers only. Address IE image cache not firing onload bug: panoramio.com/blog/onload-event/
    this.featureImage.src=link.getAttribute("href")
    this.featureImage.onerror=function(){ //If an error has occurred while loading the image to show
    thumbnailviewer.thumbLoading.style.visibility="hidden" //Hide "loading" div, game over
    }
    },
    - John
    ________________________

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

  3. The Following User Says Thank You to jscheuer1 For This Useful Post:

    lorraine_p (12-11-2008)

  4. #3
    Join Date
    Dec 2008
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    that's great I'll do that, thanks very much!

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
  •