Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/12/2009, 11:44
r4mos
 
Fecha de Ingreso: abril-2008
Mensajes: 12
Antigüedad: 16 años, 9 meses
Puntos: 2
Respuesta: Desplegar un div lentamente hacia abajo

Si a alguien le interesa, lo logré asi:

Código:
<html>
<head>
<style>
#img{
	height:70px;
	width:70px;
	background:url(img.gif);
}
</style>
<script type="text/javascript">
var heightDiv;
var id;
var heightVar=0;
function mostrarDiv(cual,altura){
	id=cual;
	heightDiv=altura;
	if(document.getElementById(id).style.display=='none'){
		document.getElementById(id).style.height=heightVar+"px";
		document.getElementById(id).style.display='block';
		expandir();
	}
}
function expandir(){
	if(heightVar++<heightDiv){
		document.getElementById(id).style.height=heightVar+"px";
		if((heightVar*100/heightDiv)>75){
			window.setTimeout ("expandir();", 20);
		}else{
			window.setTimeout ("expandir();", 5);
		}
	}
}
</script>

</head>

<body>
		<a href="javascript:mostrarDiv('iddiv',70);">Mostrar Div</a>
		<div id="iddiv" style="overflow:hidden; display:none">
			<div id="img"></div>
		</div>
</body>

</html>