0
我在調用applet方法後試圖用jquery更新進度條時出現問題。我將文件複製到調用小程序方法的移動設備。除了進度條更新以外的所有內容似乎都能正常工作如何在每次在循環內調用applet方法時進行進度條更新(不僅在循環完成時)?
這些文件的副本在所有瀏覽器中都能正常工作,但只有在firefox中,每次applet方法完成後,進度條纔會更新。其他瀏覽器在所有工作完成後都會更新進度條(循環結束)。
這是我的進度條代碼:
<div class="progress progress-striped active" id="progress_bar">
<div class="bar" id="progress-bar-count" style="width: 0%;">0%</div>
</div>
這是我的JavaScript邏輯(在Firefox工作完美):
var totalSize=0;
var currTotalSize=0;
//files infos
totalSize=getXMLData(xml,'XML.FILES-SIZE');
var files = getXMLData(xml,'XML.FILES.FILE.FILE-PATH');
var filesSizes = getXMLData(xml,'XML.FILES.FILE.FILE-SIZE');
for(var index=0; index<files.length && status==true; index++){
var appletReturn = $("#applet")[0].copyFiles(files[index]);
if(appletReturn=="true"){
currTotalSize+=parseInt(filesSizes[index]);
var percentage=calcPercentage(currTotalSize, totalSize); //simple rule of 3
$('#progress-bar-count').text(percentage+'%');
$('#progress-bar-count').css('width', percentage+'%');
}
else{
status=false;
}
}
你能helpe我做的JavaScript調用之前的進度條進行更新小程序的方法呢?
謝謝。
謝謝!如果applet返回錯誤,我該如何中斷這個執行?步驟=總計 – Bagata 2014-09-22 17:23:21
雖然它的運行,如果你想在任何時候停止它(total == null) - http://jsfiddle.net/kagpe8u9/ – Tasos 2014-09-22 17:57:13
工程就像一個魅力,但爲什麼* total == null *而不僅僅是*總= NULL *? – Bagata 2014-09-22 18:49:16