3
我正在使用blueimp File Upload plugin來實現一些文件上傳功能,我注意到,當我的上一個文件進度條達到100%時,以及停止和完成事件發生時,可能會有很大的時間間隔。我有以下代碼:上次文件進度達到100%和停止/完成事件之間的巨大差距?
$('#fileupload').fileupload({
dataType: 'json',
progress: function (e, data) {
var progress = parseInt(data.loaded/data.total * 100, 10);
var bar = data.context.children().children(".progress");
$(bar).css("width", progress + "%");
},
add: function (e, data) {
data.context = $("<div></div>").html("Uploading...<div class='progressHolder'><div class='progress'> </div></div>").appendTo($("#files"));
data.submit();
$("#processing").fadeIn();
},
stop: function (e, data) {
$("#uploadFiles").fadeIn();
$("#processing").fadeOut();
},
done: function (e, data) {
$.each(data.result.files, function (index, file) {
idArray.push(file.Id);
});
}
});
有沒有人知道爲什麼會發生這種情況?我怎樣才能讓進度條在完成/停止時被考慮進去?
很好的解釋和狡猾的工作。謝謝! –