Ir para conteúdo

POWERED BY:

Arquivado

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

eronventer

Resize iFrame

Recommended Posts

Ae pessoal!

 

Estou fazendo com que meu iframe redimensione conforme a altura do conteúdo carregado nele, porém quando

carrego uma página maior que minha janela e depois retorno para uma página menor o redimenciosamento não

acontece, ficando o scroll do browser...como eu poderia resolver isso?

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
html {
	height: 100%;	
}

body {
	margin: 0;
	background-color: #FFF;
	height: 100%;	
}
</style>
<script language="javascript" src="jquery.js"></script>
<script language="javascript">
$(document).ready(function(){
	
	$("#oframe").bind('load', function(){
		resizeIframe();					   
	});
	
});

function resizeIframe()
{
	$("#oframe").height($("#oframe").contents().height());
        $("#debug").empty().html("Tamanho: "+$("#tabela").height()); //Para debug
}
</script>
</head>

<body>	

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" id="tabela">
	<tr>
		<td height="120" bgcolor="#00CC00"> </td>
	</tr>
	<tr>
		<td height="34" bgcolor="#999999"> </td>
	</tr>
	<tr>
		<td height="30"><div id="debug"></div></td>
	</tr>
	<tr>
		<td valign="top">
				<iframe id="oframe" scrolling="no" frameborder="0" src="teste1.html" width="890" height="350"></iframe>
		</td>
	</tr>
	<tr>
		<td height="30"> </td>
	</tr>
	<tr>
		<td height="54" bgcolor="#999999"> </td>
	</tr>
</table>

</body>
</html>

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.