Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Vandrao

Problema com offsetHeight

Recommended Posts

Fla ae brothers....

 

To com um problema com o offsetHeight....

ele não pega o tamanho inteiro do body..

 

Sempre fica um espaço faltando....

 

meu código:

 

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>		function GeraBloco(){			var tagbody = document.body;			var divtudo = document.getElementById("tudo");			var divtransp = document.getElementById("divtransp");			//cria pagina			var divpagina = document.createElement("div");			divpagina.setAttribute("id","divpagina");			divpagina.className = "pagina";			divpagina.style.marginRight = (tagbody.offsetWidth - 600)/2+"px";			divpagina.style.marginLeft = (tagbody.offsetWidth - 600)/2+"px";			tagbody.insertBefore(divpagina,divtransp);			w3Opacity.set("divpagina",0);			FadeAparece("divpagina",0,100,300);		}		function FadeAparece(id,ini,fim,tempo){		w3Opacity.fading(id,ini,fim,tempo);		}		function GeraPagina(IdEmpresa){			var tagbody = document.body;			var divtudo = document.getElementById("tudo");			//cria a div transparente			var divtransp = document.createElement('div');			divtransp.setAttribute('id',"divtransp");			divtransp.className = "transp";			//cria estilo da transparencia			var telaaltura = divtudo.clientHeight;			var telalargura = tagbody.offsetWidth;						divtransp.style.height = telalargura+"px";			divtransp.style.width = telalargura+"px";			divtransp.style.position = "absolute";			divtransp.style.background = "#C3C3C3";						//mostra na tela			tagbody.insertBefore(divtransp,divtudo);			w3Opacity.set("divtransp",0);			FadeAparece("divtransp",0,60,500);			setTimeout("GeraBloco()",800);		}</div>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Isso acontece da seguinte maneira: se o conteúdo da tela só estiver ocupando apenas metade do tamanho total da tela, esse será o valor retornado, ex. 500 retorna 250, só declarando no seu css body{heigth: 100%}, que retornaria 500

Compartilhar este post


Link para o post
Compartilhar em outros sites

fiz isso tbm mais não adiantou...dai fiz assim:

 

<div class='codetop'>CODE</div><div class='codemain' style='height:200px;white-space:pre;overflow:auto'>				if(navigator.appName == "Microsoft Internet Explorer"){					var telaaltura = divtudo.clientHeight;				}else{					if(document.documentElement.scrollHeight > 0){						var telaaltura = document.documentElement.scrollHeight;					}else{						var telaaltura = divtudo.clientHeight;					}				}				var telalargura = tagbody.offsetWidth;</div>
até agora não deu nenhum problema....ja ja vai da kkk certeza...

Compartilhar este post


Link para o post
Compartilhar em outros sites

tenta issoo aii.....

 

function getPageSize(){		var xScroll, yScroll;		if (window.innerHeight && window.scrollMaxY) {			xScroll = document.body.scrollWidth;		yScroll = window.innerHeight + window.scrollMaxY;	} else if (document.body.scrollHeight > document.body.offsetHeight){ 		xScroll = document.body.scrollWidth;		yScroll = document.body.scrollHeight;	} else { 		xScroll = document.body.offsetWidth;		yScroll = document.body.offsetHeight;	}		var windowWidth, windowHeight;	if (self.innerHeight) {		windowWidth = self.innerWidth;		windowHeight = self.innerHeight;	} else if (document.documentElement && document.documentElement.clientHeight) { 		windowWidth = document.documentElement.clientWidth;		windowHeight = document.documentElement.clientHeight;	} else if (document.body) { 		windowWidth = document.body.clientWidth;		windowHeight = document.body.clientHeight;	}				if(yScroll < windowHeight){		pageHeight = windowHeight;	} else { 		pageHeight = yScroll;	}	// for small pages with total width less then width of the viewport	if(xScroll < windowWidth){			pageWidth = windowWidth;	} else {		pageWidth = xScroll;	}	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);}

dai qdo você precisa pegar algum valor da função você usa assim

 

document.getElementById('iddaDIV').style.width  = arrayPageSize[0] + 'px';	document.getElementById('iddaDIV').style.height = arrayPageSize[1] + 'px';

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.