View Full Version : Auto Centering Pop-up Window Script

10-01-2005, 08:22 PM
Is it possible to use the Auto Centering Pop-up window script

in tandem with the Image Thumbnail Viewer II script?

Using the latter script, I have thumbnails that spawn the fullsize image on the page. Now, I want that fullsize image to spawn a pop-up window using the "Auto Centering" or any other script possible when clicked.

Is this crazy thing possible?

10-03-2005, 05:23 AM
Put both scripts on your page as per instructions. Since the thumb script already provides for links to be associated with each larger sized image, use that to set the urls. Then in the thumb script change this line:

imghtml='<a href="'+theimg[1]+'" target="'+optlinktarget+'">'to:

imghtml='<a href="'+theimg[1]+'" onclick="NewWindow(this.href,\'newWin\',400,400,1);return false">'The number one at the end is for scrollbars=yes, use a zero for scrollbars=no. This will work fine if all your pop-ups are to be 400x400 or you can edit these numbers to suit but, all pop-ups will follow those dimensions. If you need each pop-up to follow unique dimensions, a little more work is needed. Add the dimensions to the image array, ex:

var dynimages=new Array()
dynimages[0]=["photo1.jpg", "http://www.cnn.com", 400, 320]
dynimages[1]=["photo2.jpg", "http://www.yahoo.com", 350, 200]
dynimages[2]=["photo3.jpg", "http://www.google.com", 375, 188]and our line that we edited above now becomes:

imghtml='<a href="'+theimg[1]+'" onclick="NewWindow(this.href,\'newWin\','+theimg[2]+','+theimg[3]+',1);return false">'If you go this route, you must configure dimensions in the array for all images that have links.