我正在使用blueimp 文件上传插件来实现一些文件上传功能,我注意到在我的最后一个文件进度条达到 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);
                });
            }
        });
有谁知道为什么会发生这种情况?我怎样才能做到这一点,以便在调用完成/停止时考虑进度条?