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!

Categories

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);
}


image

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: http://www.bristolmassive.pwp.blueyonder.co.uk/anomoly.jpg). 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.