Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Resize an existing popup window

Reply
Thread Tools

Resize an existing popup window

 
 
Nigel Molesworth
Guest
Posts: n/a
 
      06-24-2005
I'm using a combination of various "googled" scripts to generate
borderless pop-ups when a thumbnail is clicked, see below. At present it
works OK, a new image takes the place of an old one, the pop up goes if
you close the parent etc.

My problem is that I would really like to resize an existing window if
one exists, rather than close and make a new one. See ******

I've tried .resizeTo() but it seems to come up with a tiny window.

Any thoughts?




var popwin='';

function viewPic(img)
{
picfile = new Image();
picfile.src =(img);
fileCheck(img);
}


function fileCheck(img)
{
if( (picfile.width!=0) && (picfile.height!=0) )
{
checkExisting(img);
}
else
{
funzione="fileCheck('"+img+"')";
intervallo=setTimeout(funzione,50);
}
}


function checkExisting(img)
{
if (popwin.location && !popwin.closed)
{
popwin.close();
makeWindow(img)
//popwin.location.href = img; need a tidy here, but it works ******
// popwin.focus();
}
else {makeWindow(img)}
}


function makeWindow(img)
{
ht = picfile.height;
wd = picfile.width;

var args= "height=" + ht + ",innerHeight=" + ht;
args += ",width=" + wd + ",innerWidth=" + wd;

popwin=window.open("","_blank",args)
popwin.document.open()
popwin.document.write('<html><head><title>'+img+'</title></head><body
bgcolor=white scroll=no topmargin=0 leftmargin=0 rightmargin=0
bottomargin=0 marginheight=0 marginwidth=0> <div style="position:
absolute; top:0px;left:0px"><a href="javascript:window.close()"> <img
src="'+img+'" width="'+wd+'" height="'+ht+'"
border="0"></a></div></body></html>')
popwin.document.close()
}


function tidy() {
if (popwin.location && !popwin.closed) {
popwin.close(); }
}

// Based on JavaScript provided by Peter Curtis at www.pcurtis.com &
// http://www.therotunda.net/code/autos...up-window.html -->

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
user can't resize popup window in IE James Black Javascript 5 05-02-2006 12:53 PM
Howto correct resize a popup window (cross Browser) GTi Javascript 1 02-05-2006 08:46 PM
Resize popup window to fit text Terren ASP General 4 09-29-2005 11:11 AM
New Popup Window from an existing Popup Window Raffi Javascript 4 08-12-2004 01:21 PM
Main > Popup > Popup > Close popup AND new URL in main? Jens Peter Hansen Javascript 7 06-19-2004 08:56 PM



Advertisments