2011-10-12 54 views
1

因爲PhoneGap不支持sql遷移,而且android還不支持html5進度標籤,我決定創建自己的問題是我不知道該怎麼做。Phonegap&Jquery - 自定義進度條

我想用進度條填充sql表格,通知用戶完成了多少工作,還有多少工作要做。

下面是它應該是什麼樣子:

function injectSql() { 

    // lineToUse = sql query() 
    // lineToUse = sql query() 
    // and so on. I don't want to use var as there are plenty of this injections and it'll crash the phone. 
    return LineToUse; 
} 

function sqlCounter() { 

    var injThisLine = injectSql(lineToUse); 

    db.transaction (
    function(t){ 
     db.executeSql(injThisLine); 
    }); 

    alert (injThisLineKey + 'out of nn'); 
} 

道歉,如果我不做任何意義。

謝謝。

回答

0

以下是我們可以使用的進度條代碼。

http://docs.jquery.com/UI/Progressbar

可以導入JS和上面的鏈接給CSS文件,然後你可以使用Android上的Web應用程序下面的代碼。

$(function() { 

     $("#progressbar").progressbar({ value: 10 }); 
     setTimeout(updateProgress, 500); 

     }); 

     function updateProgress() { 
      var progress; 
      progress = $("#progressbar") 
      .progressbar("option","value"); 
      if (progress < 100) { 
       $("#progressbar") 
       .progressbar("option", "value", progress + 5); 
       setTimeout(updateProgress, 500); 
      } 
     } 

這會在延遲半秒後以五的增量移動進度。您可以根據需要修改它。

請讓我知道如果這有助於你

親切的問候,

Summved