Pop-up Resize.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
conscience
Forum Commoner
Posts: 33
Joined: Mon Dec 27, 2004 12:34 pm

Pop-up Resize.

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

If memory serves me, some browsers have a minimum size limit they allow for a popup.
conscience
Forum Commoner
Posts: 33
Joined: Mon Dec 27, 2004 12:34 pm

Post 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.
User avatar
SystemWisdom
Forum Commoner
Posts: 69
Joined: Sat Mar 26, 2005 5:54 pm
Location: A Canadian South of the 49th Parallel

Re: Pop-up Resize.

Post 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!
conscience
Forum Commoner
Posts: 33
Joined: Mon Dec 27, 2004 12:34 pm

Re: Pop-up Resize.

Post 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.
Post Reply