问题:
在进度条完成后但在 setTimeout() 启动之前将文本附加到 div。
HTML 代码:
<div id="loading" class="files"></div>
jQuery代码:
<script>
$(function () {
'use strict';
// Server-side upload handler:
var url = 'process.php';
$('#fileupload').fileupload({
url: url,
autoUpload: true,
acceptFileTypes: /(\.|\/)(txt)$/i,
maxFileSize: 5000000, // 5 MB
done: function (e, data) {
setTimeout(function(){
window.location = "explorer.php";}, 2000);
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .progress-bar').css(
'width',
progress + '%'
);
}
}).prop('disabled', !$.support.fileInput)
.parent().addClass($.support.fileInput ? undefined : 'disabled');
});
</script>
期望的结果:
进度条达到 100% 后,将文本“Loading ...”附加到 div,然后启动 setTimeout()。