Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/01/2015, 11:35
Avatar de victor5atodogas
victor5atodogas
 
Fecha de Ingreso: junio-2010
Mensajes: 447
Antigüedad: 13 años, 10 meses
Puntos: 2
Respuesta: Error con efecto "cargando" en algunos navegadores

Ok no hay problema, os dejo el código de ejemplo:


Código Javascript:
Ver original
  1. $(document).ready(function() {
  2.    
  3.     open_loading();
  4.        
  5.     load_calendario1();
  6.     load_calendario2();
  7.    
  8.     web_cargada = true;
  9.    
  10.     close_loading();    
  11. });
  12.  
  13. function load_calendario1()
  14. {
  15.     open_loading();
  16.    
  17.     $.ajax({
  18.         type: "POST",
  19.         url: url1,
  20.         async: false,
  21.         cache: false,
  22.         dataType : "json",
  23.         data: {
  24.             ajax: true,
  25.             action: "action"},
  26.         cache: false,
  27.         success: function(jsonData, textStatus, jqXHR)
  28.         {
  29.             jsonData = $.parseJSON(jsonData);
  30.             if(jsonData.errors==false)
  31.             {
  32.                
  33.             }
  34.             close_loading();
  35.         }
  36.     });
  37. }
  38.  
  39. function load_calendario2()
  40. {
  41.     open_loading();
  42.    
  43.     $.ajax({
  44.         type: "POST",
  45.         url: url1,
  46.         async: false,
  47.         cache: false,
  48.         dataType : "json",
  49.         data: {
  50.             ajax: true,
  51.             action: "action"},
  52.         cache: false,
  53.         success: function(jsonData, textStatus, jqXHR)
  54.         {
  55.             jsonData = $.parseJSON(jsonData);
  56.             if(jsonData.errors==false)
  57.             {
  58.                
  59.             }
  60.             close_loading();
  61.         }
  62.     });
  63. }  
  64.  
  65. function open_loading()
  66. {
  67.     $('body').addClass("loading");
  68. }
  69.  
  70. function close_loading()
  71. {
  72.     if(web_cargada==true)
  73.     {
  74.         $('body').removeClass("loading");        
  75.     }    
  76. }