Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/05/2011, 00:29
jmquintela
 
Fecha de Ingreso: mayo-2011
Mensajes: 3
Antigüedad: 13 años
Puntos: 0
agrandar ventana al 100%

Hola.
tengo el siguiente script para controlar que un div con id "wrapper" se agrande a una altura 100%.
este es el codigo:
Código Javascript:
Ver original
  1. <script language='JavaScript'>
  2.  
  3.  
  4.   window.onload = window.onresize = function ResizeIFrame() {
  5.                 var div = document.getElementById("wrapper");
  6.                 var myWidth = 0, myHeight = 0;
  7.                
  8.                 if (typeof (window.innerWidth) == 'number') {
  9.                     //Non-IE
  10.                     myWidth = window.innerWidth ;
  11.                     myHeight = window.innerHeight - 90;
  12.  
  13.                 } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
  14.                     //IE 6+ in 'standards compliant mode'
  15.                     myWidth = document.documentElement.clientWidth ;
  16.                     myHeight = document.documentElement.clientHeight - 90 ;
  17.                 } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
  18.                     //IE 4 compatible
  19.                     myWidth = document.body.clientWidth;
  20.                     myHeight = document.body.clientHeight - 90;
  21.                 }
  22.                 div.style.width = myWidth + 'px';
  23.                 div.style.height = myHeight + 'px';
  24.             }  
  25.  
  26.  
  27. </script>

el único problema que tengo es que el script espera a que cargue el contenido por completo para ajustar el div, y en muchos casos eso puede tjomar varios segundos. me gustaría saber como hago para que antes de cargar el contenido la ventana se ajuste.
aqui pueden ver el ejemplo de como se comporta en mi web:

[URL="http://www.jmquintela.cl/?page_id=145"]http://www.jmquintela.cl/?page_id=145[/URL]

saludos!