如何使用 Pace.JS 获得进度百分比
how to get the progress percentage with Pace.JS
我正在使用 pace.js 加载我的网站。但我不想使用 pace.js 主题。我想建立我的主题。
有什么方法可以让我在 jquery 上取得进展?
我只知道这个函数:
Pace.on("start", function(){
});
Pace.on("done", function(){
})
只需在第 296 行添加:
Pace.trigger('update', this.progress);
然后像这样:
Pace.on("update", function(percent){
});
我也这样做过
Pace.bar.update = function(prog) {
Pace.trigger('update', prog)
this.progress = prog;
return this.render();
} // override update func to trigger 'update' event
以后
Pace.on('update', progress => {
console.log('progress -> ', progress);
})
我正在使用 pace.js 加载我的网站。但我不想使用 pace.js 主题。我想建立我的主题。
有什么方法可以让我在 jquery 上取得进展?
我只知道这个函数:
Pace.on("start", function(){
});
Pace.on("done", function(){
})
只需在第 296 行添加:
Pace.trigger('update', this.progress);
然后像这样:
Pace.on("update", function(percent){
});
我也这样做过
Pace.bar.update = function(prog) {
Pace.trigger('update', prog)
this.progress = prog;
return this.render();
} // override update func to trigger 'update' event
以后
Pace.on('update', progress => {
console.log('progress -> ', progress);
})