Browse Source

sistemato il loader

cek@posta.indivia.net 7 năm trước cách đây
mục cha
commit
9af340d0a5
2 tập tin đã thay đổi với 27 bổ sung10 xóa
  1. 5 5
      www/js/crud.events.js
  2. 22 5
      www/js/main.js

+ 5 - 5
www/js/crud.events.js

@@ -30,11 +30,11 @@ EVENTS.eventsLoaded = 0;
 EVENTS.render = function() {
     EVENTS.eventsLoaded = 0;
     
-    //Se si lancia il loader prima che sia cambiata pagina il loader scompare,
-    // ritardando invece che appaia, quando appare è già sulla pagina in cambiata
-    setTimeout(function () {
-        $.mobile.loading('show');
-    }, 300);
+//    //Se si lancia il loader prima che sia cambiata pagina il loader scompare,
+//    // ritardando invece che appaia, quando appare è già sulla pagina in cambiata
+//    setTimeout(function () {
+//        $.mobile.loading('show');
+//    }, 300);
     
     var ret = checkConnection('ERR_EVENT');
     if (ret) {

+ 22 - 5
www/js/main.js

@@ -63,7 +63,20 @@ function displayLastUpdateDate() {
 function alterContent(url) {
     var paginacorrente = $("body").pagecontainer("getActivePage").attr("id");
 
-    switch (url) {
+    var oldUrl = url;
+
+    $( "#outside" ).panel( "close" );
+    // Alter the url according to the anchor's href attribute, and
+    // store the data-foo attribute information with the url
+    $.mobile.navigate(url);
+
+    //Se si lancia il loader prima che sia cambiata pagina il loader scompare,
+    // ritardando invece che appaia, quando appare è già sulla pagina in cambiata
+//    setTimeout(function () {
+//        $.mobile.loading('show');
+//    }, 300);
+
+    switch (oldUrl) {
     case '#index':
         $("#navheader").addClass("hide");
         $("#navfooter").addClass("hide");
@@ -108,10 +121,10 @@ function alterContent(url) {
         myJsonRandomPost('#titolosingleR', '#mostracontentsingleR');
         break;
     }
-    $( "#outside" ).panel( "close" );
-    // Alter the url according to the anchor's href attribute, and
-    // store the data-foo attribute information with the url
-    $.mobile.navigate(url);
+//    $( "#outside" ).panel( "close" );
+//    // Alter the url according to the anchor's href attribute, and
+//    // store the data-foo attribute information with the url
+//    $.mobile.navigate(url);
 }
 /*///////////////utilities//////////////http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript*/
 function getParameterByName(name, url) {
@@ -147,6 +160,10 @@ function initMainPage() {
 document.addEventListener("deviceready", onDeviceReady, false);
 //le cose all'inizio
 
+$(document).on("pagecontainershow", function (e, ui) {
+    $.mobile.loading('show');
+});
+
 $(document).on("mobileinit", function () {
     $("body").pagecontainer({
         defaults: true