View Full Version : CMotion Image Gallery - text title new window

01-16-2008, 04:42 AM
CMotion Image Gallery II


Is there a way to change the "text title" of the enlarged version of the thumbnail when it pops up in a new window?

Thanks in advance for your assistance.


01-16-2008, 06:45 AM
There is no 'text title' per se, I think you mean the text appearing in the title bar of the pop up window. That would be governed by the enlargeimage function, which is completely user editable, however - you do need some fairly considerable familiarity with javascript to do so by yourself.

One thing that you should be aware of is that in all modern browsers, for live pop up windows, there are certain requirements. One is that (for security reasons) the domain name be displayed. Most browsers use the title bar for this when (as is the case with the default pop up for this script) there is no address bar. You can get your own title to display, but it will usually be preceded with the domain name, unless the particular browser chooses another spot to display the domain name (Opera, for instance uses a separate bar between the main window of the pop up and the top 'chrome'). Most use the title bar.

You can use something like so:

function enlargeimage(path, title, optWidth, optHeight){ //function to enlarge image. Change as desired.
var actualWidth=typeof optWidth!="undefined" ? optWidth : "600px" //set 600px to default width
var actualHeight=typeof optHeight!="undefined" ? optHeight : "500px" //set 500px to default height
var winattributes="width="+actualWidth+",height="+actualHeight+",resizable=yes"
var cpop=window.open("","", winattributes)
cpop.document.write('<title>'+title+'<\/title><body style="margin:0;padding:0;"><img src="'+path+'">');

in place of the current enlargeimage function. But you will need to include the title in your call to it, ex (I'm not wild about the method used to invoke enlargeimage in the demo, but I'm gong to just add to it anyway to avoid throwing too much at you at once):

<a href="javascript:enlargeimage('dynamicbook1.gif', 'O\'Reily\'s Dynamic HTML')"><img src="dynamicbook1.gif" border=1></a>

You can still include the optional width and height after that if you like in the normal manner. Notice that apostrophes/single quote marks (') included in the title string must be escaped with the slash (\).

01-17-2008, 06:33 PM
Hi John,
Thanks very much. I'm not that familiar with javascript but I'll play around with it over the weekend to see if I can get it to work.

Also, is there a way to have the scrolling action start automatically? No problem if it's not... just curious.:)

Thanks again,