Javascript Jquery进度条主体

Javascript Jquery进度条主体,javascript,jquery,html,Javascript,Jquery,Html,我尝试用javascript制作一个“假”进度条,加载进度条,当它完成时,主体变为可见,并且开始工作,但我使用setTimeout,我想在进度条完成时启动主体!那么我怎样才能听进度条完成呢 //PROGRESS BAR var _start = {property: 0}; var _end = {property: 100}; jQuery(_start).animate(_end, { duration: 2000, step: function progress() {

我尝试用javascript制作一个“假”进度条,加载进度条,当它完成时,主体变为可见,并且开始工作,但我使用setTimeout,我想在进度条完成时启动主体!那么我怎样才能听进度条完成呢

//PROGRESS BAR

var _start = {property: 0};
var _end = {property: 100};
jQuery(_start).animate(_end, {
    duration: 2000,
    step: function progress() {
    $('#loading').css('width', this.property + "%");        
    //console.log( 'Current percentage is ' + this.property );// You can write this to your bar
    }
});


function show() {
    $('#loading').hide();
    $('#container').css({'visibility':'visible'});
    $('#bloc').css({'visibility':'visible'});
};

setTimeout(show, 2000);
我的css:容器是隐藏的,并且是块状的!
太多了

有不同的方法来实现这一点。。。但这里有一个简单的演示和源代码,您可以使用它来完成它

jQuery(_start).animate(_end, {
    duration: 2000,
    step: function progress() {
    $('#loading').css('width', this.property + "%");        
    //console.log( 'Current percentage is ' + this.property );// You can write this to your bar
    },
    done: function () {
       show();
    }
});
演示


下载

动画完成后,进度条不应该完成吗?开始是否确实在制作动画?