View Full Version : click image for a closer look

03-10-2008, 02:53 PM
hi guys and girls,

I have a javascript that is pretty simple. I have an image and above it, a link "Click here for a closer look". When the user presses it, a new window pops up with the image inside.

My probelms is that the images are being retrieved from my database, all shapes and sizes, so i cant really specify a height and width. Is there a way of making the window adjust to the size of the image instead??

here is my javascript;

function popitup(url) {
newwindow=window.open(url,'name','height=0,width=0 ');
if (window.focus) {newwindow.focus()}
return false;

kind regards

d a v e
03-10-2008, 08:43 PM
how about something like this
http://www.huddletogether.com/projects/lightbox2/ ?

03-10-2008, 09:42 PM
Hi Dave,

I'm seeing this everywhere, and it's kinda like "oh not again".

Saying that, i am a huge fan of it and i have used it on some of my projects.

I think i may have to use this.

kind regards

d a v e
03-11-2008, 12:11 PM
i think there's a couple of variations lik graybox (greybox?) thickbox etc. also you can change the stylesheet and make it look a bit different, even change the colour of the overlay too ;)

yeah it is quite popular :) but it's also easy and works well.

03-19-2008, 05:04 PM
I had an issue like yours. I set my database up like this for the images.

id | image | width | height

set variables for the width and height and when you click that image have the variables in-place of of the width and height of the java script.