Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/11/2008, 11:11
Avatar de marcopoloaz06
marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: México
Mensajes: 457
Antigüedad: 16 años, 9 meses
Puntos: 11
Respuesta: Pierdo un dato con Jquery

Hola, asi queda:
Código javascript:
Ver original
  1. ///////////////////////// - CONFIGURACIONES - ///////////
  2. var div_move_selected="div.move_selected";
  3. var div_data="#data";
  4. var index = 0;
  5. ////////////////////////////////////////////////////////
  6. var image=new Array();
  7. image[0]='images/pueba/1.jpg';
  8. image[1]='images/pueba/2.jpg';
  9. image[2]='images/pueba/3.jpg';
  10. ////////////////////////////////////////////////////////
  11. $(document).ready(function(){
  12.     var div_pr = $("#pr_td_1, #pr_td_2, #pr_td_3");
  13.     var coord = $(div_pr[ index ] ).position();
  14.     $(div_move_selected).css( {"left":coord.left,"top":coord.top} ).show();
  15.     $(div_data).css( {"background-image":"url("+image[index]+")"} );
  16.     $.each( div_pr, function(i, e, a){
  17.         $(div_pr[i]).click(function(){
  18.             var coord = $(this).position();
  19.             $(div_move_selected).animate( {"left": coord.left, "top": coord.top}, 500, function(){
  20.                 $(div_data).css("backgroundImage","url("+image[i]+")");
  21.                 alert( i );
  22.             });
  23.         });
  24.     });
  25. });
nos vemos
:]
__________________
Aerolíneas Alicia :D