Ver Mensaje Individual
  #4 (permalink)  
Antiguo 25/10/2009, 12:39
lalcey
 
Fecha de Ingreso: octubre-2008
Mensajes: 5
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: OnMouseOut: El eterno problema

Muchas gracias a los dos!.

Panino5001, interesantisimo el articulo, he aprendido bastante leyendolo, pero no consigo aplicarlo a la forma en que hago esto.

He sacado un ejemplo de como lo hago, para ponerlo por aqui:

Código javascript:
Ver original
  1. Elemento = function(id,altura){
  2.   var thislocal = this;
  3.   var Tmp, Tmp2;
  4.  
  5.   this.id = id;
  6.   this.altura=altura;
  7.  
  8.   document.getElementById(id).onmouseover= function(){thislocal.Desplegar()};
  9.   document.getElementById(id).onmouseout= function(){thislocal.Plegar()};
  10. }
  11.  
  12. Elemento.prototype.Desplegar = function(){
  13.   var obj = document.getElementById(this.id);
  14.   var thislocal= this;
  15.  
  16.   if (this.altura<195){
  17.     this.altura+=10;
  18.     this.Tmp=setInterval(function(){thislocal.Desplegar()},25);
  19.   }else{
  20.     clearInterval(this.Tmp)
  21.   }
  22.  
  23.    obj.style.height=this.altura;
  24. }
  25.  
  26. Elemento.prototype.Plegar = function(){
  27.   var obj = document.getElementById(this.id);
  28.   var thislocal= this;
  29.  
  30.   if (this.altura>30){
  31.     this.altura-=10;
  32.     this.Tmp2=setInterval(function(){thislocal.Plegar()},25);
  33.   }else{
  34.     clearInterval(this.Tmp2)
  35.   }
  36.  
  37.    obj.style.height=this.altura;
  38. }
  39.  
  40. var E = new Elemento('DSubMenu',30);

Y el codigo HTML:

Código html:
Ver original
  1. <div id="DPrincipal" style="overflow:hidden;height:200px;width:150px;">
  2.   <div id="DSubMenu" style="overflow:hidden;height:30px;width:135px;border: 1px solid;">
  3.     <center>Info</center>
  4.     <br><br>
  5.     <a href="#">Informacion1</a><br>
  6.     <a href="#">Informacion2</a><br>
  7.     <a href="#">Informacion3</a><br>
  8.     <a href="#">Informacion4</a>
  9.   </div>
  10. </div>

(Esto es un simple ejemplo de la forma que utilizo para hacer esto).

El problema esta, a la hora de meter las funciones Desplegar() y Plegar(), si lo hago sin estas funciones, haciendo que el efecto sea directo, no tengo estos problemas.

¿Alguna forma de interpretarlo?

Salu2!