View Full Version : Auto-centering Popup Window

03-01-2007, 09:45 AM
1) Script Title: Auto-centering Popup Window

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/autocenter.htm

3) Describe problem:

For my website I have used a.m. script to show an enlarged detail of a painting. See http://www.arti-mo.com/kunstenaars/jst/kunstwerkjst005.htm and than click on "klik hier voor een detail van het kunstwerk".

Now the size of the window that will be openened is fixed on 1024 px width and 768 px height. The picture to be shown has a size of 525 x 700 px, but can sometimes be different.

Is there a way to change the script in such a way that the size of the window to be opened will adjust itself automatically to the size of the picture that will be shown?

Thanks for any usefull help!

Enjoy your day ;)

03-01-2007, 05:03 PM
I'm not sure what a.m. script is. The DD script that you are using can accept whatever dimensions that you wish to pass to it. If, in addition to that, you pass it a unique name for each invocation, things should work out fairly well.

03-01-2007, 06:03 PM
I realize I can use any size required, however now I would need to change the size for every new item or have a fixed size for all items and accept a window with white areas.

Is there a way to work with sort of "flexible" size for each item that adjust the windowsize automatically to the size needed for each picture? In order to avoid I'd have to change it for every item... In fact I'm a bit lazy... :rolleyes:


03-01-2007, 06:14 PM
You really cannot 'get' the dimensions of an image until it is loaded. With images of the size of your example, that would take too long. However, if you abandon a pop up viewer in favor of one like:




Since the image will be displayed on the page, size is no longer an issue. These two scripts have the added advantage that they cannot be blocked by pop up blockers.

03-12-2007, 01:20 AM
That's a very good idea John. In fact I have just used Lightbox image viewer 2.0 in the new website I am developping for a foundation that organizes special events for metally and physically handicapped persons in Holland. I have a specific question about this, which I will post within the next minutes in a new thread.