Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window resize

Status
Not open for further replies.

goaganesha

Programmer
Dec 4, 2001
178
BE
Hi,

My website starts with a flashintro in a small popupwindow.
At the end of the movie, I open a new window which has to open to full screensize so in the new window i've put following code:


<script language=&quot;JavaScript1.2&quot;>
<!--
top.window.moveTo(0,0);
if (document.all) {
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById) {
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
//-->
</script>


This works fine but here's the problem. If visitors don't watch the flash intro, the window is allready fullsize so the javascript should be denied 'cause it makes the window shake a bit which gets very annoying after 2 or 3 times.
so I've put in an if statement but still the window shakes.
what is wrong with this code?:


<script language=&quot;JavaScript1.2&quot;>
<!--
if (top.window != (0,0) || (top.window.outerHeight != screen.availHeight && top.window.outerWidth != screen.availWidth))
{
top.window.moveTo(0,0);
if (document.all)
{
top.window.resizeTo(screen.availWidth,screen.availHeight);
}
else if (document.layers||document.getElementById)
{
if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
top.window.outerHeight = screen.availHeight;
top.window.outerWidth = screen.availWidth;
}
}
}
//-->
</script>

Thanx for your help!

regards, goaganesha
 
try something like

<script language=&quot;JavaScript1.2&quot;>
<!--
onload=function(){
var isNC=document.layers || (document.getElementById && !document.all)
var isIE=document.all || (document.getElementById && document.all)

var winleft = (isNC) ? top.screenX : (isIE) ? top.screenLeft : null;
var wintop = (isNC) ? top.screenY : (isIE) ? top.screenTop : null;
var winwidth = (isIE) ? top.document.body.clientWidth : (isNC) ? top.innerWidth : null;
var winheight = (isIE) ? top.document.body.clientHeight : (isNC) ? top.innerHeight : null;

if ((wintop!=0 && winleft!=0) && (winwidth!=screen.availWidth && winheight!=screen.availHeight)){
top.moveTo(0,0);
top.resizeTo(screen.availWidth,screen.availHeight);
}
}
//-->
</script> Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top