Page 1 of 1

Pop-up Resize.

Posted: Wed Mar 30, 2005 11:29 am
by conscience
What's wrong with this?

Code: Select all

<a href=&quote;javascript:void(0)&quote; 
onClick=&quote;javascript:window.open('inc/bigpic.php?pic=<? echo $row&#1111;&quote;itemPic&quote;]; ?>', '',
'height=100,width=100,toolbar=0,status=0,titlebar=0,menubar=0,location=0,hotkeys=0,directories=0,resizeable=0,left=426,top=282')&quote;>
Everything works fine except the window doesn't size itself according to the height/width parameters.

Posted: Wed Mar 30, 2005 11:42 am
by feyd
If memory serves me, some browsers have a minimum size limit they allow for a popup.

Posted: Wed Mar 30, 2005 12:22 pm
by conscience
feyd wrote:If memory serves me, some browsers have a minimum size limit they allow for a popup.
I've tried this with various window sizes, 100 being the smallest and 400 being the largest.

This doesn't work at all in Internet Explorer.

In Firefox, the WIDTH is applied, but not the HEIGHT.

Re: Pop-up Resize.

Posted: Wed Mar 30, 2005 1:30 pm
by SystemWisdom
I wrote this long ago, and it still works for me:

Code: Select all

function OpenSubWin( page, w, h, sb )
{  var sw = screen.width, sh = screen.height;
   var ulx = ((sw-w)/2), uly = ((sh-h)/2);
   var sbt = (sb==1) ? 'yes' : 'no';

   var paramz = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars='+sbt+',width='+w+',height='+h+'';
   var oSubWin = window.open( &quote;&quote;, &quote;SubWin&quote;, paramz );

   // To be certain size changes:
   oSubWin.resizeTo( w, h );

   oSubWin.moveTo( ulx, uly );
   oSubWin.location.replace( page );
}
So you could make your link like:

Code: Select all

// With Status Bar:
<a href=&quote;javascript:OpenSubWin('inc/bigpic.php?pic=<?php echo $row&#1111;&quote;itemPic&quote;]; ?>', 100,100,1);&quote;>

// Without Status Bar:
<a href=&quote;javascript:OpenSubWin('inc/bigpic.php?pic=<?php echo $row&#1111;&quote;itemPic&quote;]; ?>', 100,100,0);&quote;>

And it will even center the pop up window (or at least it should).. I hope that helps!

Re: Pop-up Resize.

Posted: Wed Mar 30, 2005 2:04 pm
by conscience
SystemWisdom wrote: And it will even center the pop up window (or at least it should).. I hope that helps!
Works for me, too. Tested out 100% in Firefox and IE, works like a champ.

Must've been those additional "oSubWin" parameters.

Thanks much, SysWis.