PDA

View Full Version : Mini Pop Up


orso
01-04-2007, 08:11 PM
Hey I was wondering if someone could tell me how to make a mini popup screen. Example when you click on the thumbnail image it opens a new screen on top but the screen is just a tad bit bigger then the picture.

I know how to make a pop up window (target_blank) but how to I adjust the size of the window to match the image.

chriskq
01-04-2007, 09:27 PM
OK you'll need this script

<script type="text/javascript">
function newWindow(mypage,myname,w,h,features) {
if(screen.width){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
}else{winl = 0;wint =0;}
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
</script>


that bit of code will need to be placed before the closing [/head] tag.

And now for calling your resized window, you'l do such as:

<a href="javascript: newWindow('common/images/imagenamehere.jpg','templateWin','730','400','scro llbars=yes');" title="xxxxxxx">link name here</a>


you dont have to use an image, you can call a new page (popUp.html for example)- just make sure the width and height match up

have fun