Not a Member Yet,
Click here to Register

ID: 513
Viewed: 4109
Added: Jun 11, 2004
Version: all
Snippet uploaded by: Aaron Campbell
Written By: Aaron Campbell
Demo: Sorry, no demo

User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

This is a simple image popup that opens a new window, that is the right size for the picture. If the window is too big for the users screen, it adjusts. If it has to adjust, it also adjusts the size of the image, so that the user does not need to scroll. it is called like this: openWin(picWidth,picHeight,picName)<br>

<script type='text/javascript'>
//By Aaron D. Campbell
//Feel free to remove these comments
function openWin( winWidth, winHeight, picSrc )
var picWidth = winWidth;
var picHeight = winHeight;
var i = 1;
winWidth = winWidth + 20;
winHeight = winHeight + 100;
if ((screen.availWidth-50) < (winWidth))
winWidth = (screen.availWidth-50);
i = ((winWidth-20)/picWidth);
picWidth = (winWidth-20);
picHeight = (picHeight * i);
if ((screen.availHeight-50) < (winHeight))
winHeight= (screen.availHeight-50);
i = ((winHeight-100)/picHeight);
picHeight = (winHeight-100);
picWidth = (picWidth * i);
picWidth = Math.round(picWidth);
picHeight = Math.round(picHeight);
newWin ='', '', 'height='+ winHeight + ',width='+ winWidth + 'toolbars=no, scrollbars=no' );
newWin.document.write("<html>n<head>n<title>"+ picSrc +"</title>n</head>n<body background="images/bg.gif">n");
newWin.document.write("<div style="text-align:center; ">n");
newWin.document.write("<img src="" + picSrc + "" width="" + picWidth + "" height="" + picHeight + "">n");
newWin.document.write("<br>n<br>n<form>n <input type='button' value='Close' onclick='javascript:window.close();'>n");


 <img src="whatever.jpg" width="xxx" height="xxx" border="0" alt="xxxxx" title="xxxxx" style="cursor:pointer; " onclick="openWin(picWidth,picHeight,'picName.jpg');" />

No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.

Replying to a Comment...

Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2024 All Rights Reserved. Conditions
Do NOT follow this link or you will be banned from the site!