【问题标题】:restting jquery progress bar重置jquery进度条
【发布时间】:2013-12-17 07:31:14
【问题描述】:

我有一个表示文件上传的简单 jquery 进度条,我希望在每次上传后重置它。

我已经尝试了以下在我看来应该可行的方法......但不是,

$('#fileupload').fileupload({
    dataType: 'json',
    url: 'Home/UploadFiles',
    autoUpload: true,
    done: function (e, data) {
        $('.file_name').html(data.result.name);
        $('.file_type').html(data.result.type);
        $('.file_size').html(data.result.size);
        alert("File was uploaded");
        $('.file_name').html("");
        $('.file_type').html("");
        $('.file_size').html("");
        //this is where I am attempting to reset the bar after 1.5 secs
        setTimeout(function () {
            $('#progress .progress-bar').css('width', 0);
        }, 1500);

    }
}).on('fileuploadprogressall', function (e, data) {
    var progress = parseInt(data.loaded / data.total * 100, 10);
    $('.progress .progress-bar').css('width', progress + '%');
});

【问题讨论】:

    标签: jquery progress-bar reset blueimp


    【解决方案1】:

    你做错了改进度条的position你需要改value

    $( ".progress" ).progressbar({ value: 25 });
    

    见:http://api.jqueryui.com/progressbar/#option-value

    【讨论】:

    • 谢谢。我还注意到我纠正了一个语法错误,现在看起来很好。 $('.progress .progress-bar').css('width', 0);
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多