Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/07/2009, 00:20
Avatar de Legoltaz
Legoltaz
 
Fecha de Ingreso: agosto-2008
Mensajes: 325
Antigüedad: 15 años, 9 meses
Puntos: 6
Respuesta: jQuery: Problemas con uso de variable

Cita:
Iniciado por eall Ver Mensaje
Ya entendí lo que quieres hacer.

Guarda en un atributo las dimensiones originales y cuando le hagas clic las rescatas y las cambias.

Código javascript:
Ver original
  1. $(document).ready(function(){
  2.     $("img").each(function(){
  3.         w = $(this).width();
  4.         h = $(this).height();
  5.         $(this).attr("dim", w + ":" + h);
  6.         $(this).css({width:80,height:80});
  7.     });
  8.     //$("img").css({width:80,height:80});
  9.     $("img").click(function(){
  10.         var d = $(this).attr("dim").split(":");
  11.         $(this).animate({width:d[0],height:d[1]},"slow");
  12.     });
  13. });

pruebalo y me dices como te fue.
No sé por qué, pero sigue sin funcionar, ahora ni siquiera reduce el width y heigth de las imágenes a 80.