Foros del Web » Programando para Internet » Javascript » Frameworks JS »

Problemas con ie con una funcion drug and drop

Estas en el tema de Problemas con ie con una funcion drug and drop en el foro de Frameworks JS en Foros del Web. Hola buenas chicos, Tengo un pequeño problema con IE con una tienda on-line. El problema es que la funcion drug and drop (consiste en cojer ...
  #1 (permalink)  
Antiguo 31/10/2011, 06:20
 
Fecha de Ingreso: octubre-2011
Mensajes: 25
Antigüedad: 12 años, 6 meses
Puntos: 0
Problemas con ie con una funcion drug and drop

Hola buenas chicos,

Tengo un pequeño problema con IE con una tienda on-line. El problema es que la funcion drug and drop (consiste en cojer una img del producto y arrastrala y soltarla en el carrito de la compra) no me quiere funcionar en el IE pero en los demas navegadores si que me funciona perfectamente. Y bueno ya he llegado al punto de que no se que hacer para que esto me funcione. ¿alguien de por aqui me puede mirar donde está el error de mi script ?.

Código Javascript:
Ver original
  1. var purchased=new Array();
  2. var totalprice=0;
  3.  
  4. $(document).ready(function(){
  5.    
  6.     $('.product').simpletip({
  7.        
  8.         offset:[40,0],
  9.         content:'<img src="img/ajax_load.gif" alt="loading" style="margin:10px;" />',
  10.         onShow: function(){
  11.            
  12.             var param = this.getParent().find('img').attr('src');
  13.            
  14.             if($.browser.msie && $.browser.version=='6.0')
  15.             {
  16.                 param = this.getParent().find('img').attr('style').match(/src=\"([^\"]+)\"/);
  17.                 param = param[1];
  18.             }
  19.            
  20.             this.load('ajax/tips1.php',{img:param});
  21.         }
  22.  
  23.     });
  24.    
  25.     $(".product img").draggable({
  26.    
  27.     containment: 'document',
  28.     opacity: 0.6,
  29.     revert: 'invalid',
  30.     helper: 'clone',
  31.     zIndex: 100
  32.    
  33.     });
  34.  
  35.     $("div.content.drop-here").droppable({
  36.    
  37.             drop:
  38.                     function(e, ui)
  39.                     {
  40.                         var param = $(ui.draggable).attr('src');
  41.                        
  42.                         if($.browser.msie && $.browser.version=='6.0')
  43.                         {
  44.                             param = $(ui.draggable).attr('style').match(/src=\"([^\"]+)\"/);
  45.                             param = param[1];
  46.                         }
  47.  
  48.                         addlist(param);
  49.                     }
  50.    
  51.     });
  52.  
  53. });
  54.  
  55.  
  56. function addlist(param)
  57. {
  58.     $.ajax({
  59.     type: "POST",
  60.     url: "ajax/addtocart1.php",
  61.     data: 'img='+encodeURIComponent(param),
  62.     dataType: 'json',
  63.     beforeSend: function(x){$('#ajax-loader').css('visibility','visible');},
  64.     success: function(msg){
  65.        
  66.         $('#ajax-loader').css('visibility','hidden');
  67.         if(parseInt(msg.status)!=1)
  68.         {
  69.             return false;
  70.         }
  71.         else
  72.         {
  73.             var check=false;
  74.             var cnt = false;
  75.            
  76.             for(var i=0; i<purchased.length;i++)
  77.             {
  78.                 if(purchased[i].id==msg.id)
  79.                 {
  80.                     check=true;
  81.                     cnt=purchased[i].cnt;
  82.                    
  83.                     break;
  84.                 }
  85.             }
  86.            
  87.             if(!cnt)
  88.                 $('#item-list').append(msg.txt);
  89.                
  90.             if(!check)
  91.             {
  92.                 purchased.push({id:msg.id,cnt:1,price:msg.price});
  93.             }
  94.             else
  95.             {
  96.                 if(cnt>=3) return false;
  97.                
  98.                 purchased[i].cnt++;
  99.                 $('#'+msg.id+'_cnt').val(purchased[i].cnt);
  100.             }
  101.            
  102.             totalprice+=msg.price;
  103.             update_total();
  104.  
  105.         }
  106.        
  107.         $('.tooltip').hide();
  108.    
  109.     }
  110.     });
  111. }
  112.  
  113. function findpos(id)
  114. {
  115.     for(var i=0; i<purchased.length;i++)
  116.     {
  117.         if(purchased[i].id==id)
  118.             return i;
  119.     }
  120.    
  121.     return false;
  122. }
  123.  
  124. function remove(id)
  125. {
  126.     var i=findpos(id);
  127.  
  128.     totalprice-=purchased[i].price*purchased[i].cnt;
  129.     purchased[i].cnt = 0;
  130.  
  131.     $('#table_'+id).remove();
  132.     update_total();
  133. }
  134.  
  135. function change(id)
  136. {
  137.     var i=findpos(id);
  138.    
  139.     totalprice+=(parseInt($('#'+id+'_cnt').val())-purchased[i].cnt)*purchased[i].price;
  140.    
  141.     purchased[i].cnt=parseInt($('#'+id+'_cnt').val());
  142.     update_total();
  143. }
  144.  
  145. function update_total()
  146. {
  147.     if(totalprice)
  148.     {
  149.         $('#total').html('total: $'+totalprice);
  150.         $('a.button').css('display','block');
  151.     }
  152.     else
  153.     {
  154.         $('#total').html('');
  155.         $('a.button').hide();
  156.     }
  157. }

Un saludo

Etiquetas: ajax
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:16.