joh6nn
10-26-2002, 04:16 AM
this is something that i came up with a while back, but never got around to putting up. when you resize a window, you don't get the same result across different browsers because of different chrome sizes. the way around this, is to resize your window based on the visible document area. this function does that.
this should work in IE4+ and NS4+. i've tested it in IE5+, and Moz 1+
<SCRIPT><!--
self.resizeIn = function(new_w, new_h) {
var old_w = self.innerWidth || document.body.offsetWidth;
var old_h = self.innerHeight || document.body.offsetHeight;
if (!new_w) { new_w = old_w; }
if (!new_h) { new_h = old_h; }
new_w -= old_w; new_h -= old_h;
self.resizeBy(new_w,new_h);
}
//--></SCRIPT>
select sires
11-05-2002, 02:42 AM
i'm confused..but this looks like something interesting and seems worth showing my ignorance.
you can change the size of a viewers window?
i'm sort of confused on the whole thing..
could you post some sort of an example of this in action?
joh6nn
11-05-2002, 09:13 AM
http://www.joh6nn.com/script/misc/resizein.htm
select sires
11-05-2002, 05:44 PM
oh ok, i think i was trying to confuse myself:)
i guess, is it logical to use, considering you don't know what resolution most people are using, so wouldnt everything in the window have to be set up for the lower end res. ?
joh6nn
11-06-2002, 02:55 AM
in order to make things easier on myself, i work with percentages. that way, i never have to worry about whether this looks to big or small on a particular resolution.
how to make a window, a percentage of the screen size:
var width = screen.availWidth * .75;
var height = screen.availHeight * .75;
that would create a window, that is 75 percent of the screen's width and height.
tempest1
01-08-2003, 06:06 AM
Why do that when you can use easy, cross browser banner, or anything else for that matter, resizing scripts like this one?
function size_banner()
{
if(screen.width == '800' && screen.height == '600')
{
var widt=screen.availWidth-(screen.availWidth*.0275);
document.write("<img src='banner.jpg' style='position: absolute; left: 0; top: 0; border: 1px solid black;' id='banner' width='"+widt+"'>");
}
else
{
document.write("<center>\n <img src='banner.jpg' style='top: 0; border: 1px solid black;' id='banner'>\n</center>");
}
}