PDA

View Full Version : Can I center the title in Image Thumbnail Viewer



jljacobs
10-15-2007, 03:02 PM
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>

jljacobs
10-17-2007, 12:55 AM
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.