New window same as image size - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

New window same as image size

r3tr0xr3tr0x Posts: 6Member
Hey guys
I have asked on many forums about this and have receieved positive feedback, yet no soultions as of yet that are 100% what I need. Basically I have a page of thumbnails and wen one of them is clicked i want a new window to open (no scrollbars, status bar etc) the same size as the image. I recently obtained the followin script:

function openWindow(imgFile) {
var img = new Image();
img.src = imgFile;
open(imgFile, '', 'height=' + img.height + ', width=' + img.width);


Now this works to a certain extent. Except wen the pic is clicked on the resulting window is far too big, causing loads of white space to appear around the image (go here to see: Now wen the window is closed and reloaded a second time, there is far less white space, infact so much so its acceptable for my needs. I am just wondering why the image needs to be loaded a second time to eliminate the white space? What's wrong with the code? If anyone has some suggestions I would be very appreciative, been trying to sort this for months.
Sign In or Register to comment.