Results 1 to 2 of 2

Thread: Can I center the title in Image Thumbnail Viewer

  1. #1
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Can I center the title in Image Thumbnail Viewer

    1) Script Title: Image Thumbnail Viewer

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

    3) Describe problem: My problem is fairly simple I think. The code is great and everything works fine, except for that I can not figure out how to center my title in the title bar that appears within the enlarged image. I know that I can change the code within the title attribute and add a center tag, but then the <center> or whatever coding you put in appears when you scrollover the thumb. Is there a way within the .js or .css file to center this and possibly even change the bgcolor of that bar? Thanks!

    BTW, an example I have up on the web is: http://www.jefflori.com/niagara2002.html

    The first couple pictures I added titles with and without the <center>

  2. #2
    Join Date
    Oct 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I am just posting to my original topic because I figured out a fix to this problem. My expertise is not in Javascript coding, but I do have c++ and visual basic experience, so I ended up just figuring it out. Here is what I did for anyone's reference that might run into the same small issue.

    I took this code:

    if (this.enableTitle && link.getAttribute("title")) //Use title attr of the link as description?
    imageHTML+='<br />'+link.getAttribute("title")


    and changed it to this:

    var titleText= ('<div align="center">'+link.getAttribute("title")+'</div>')
    if (this.enableTitle && link.getAttribute("title")) //Use title attr of the link as description?
    imageHTML+='<br />'+titleText


    By dimensioning a new variable and using a div align="center" function on the title attribute, I then just used the new variable for the output. Hope this helps someone that comes across this issue. My apologies if my formatting and naming conventions are not up to par in javascript, but I've really never written code in javascript, just some small editing.

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
  •