我需要延迟3秒...
document.addEventListener("DOMContentLoaded", function(event) {
var x = VarPagesInChapter.getValue();
var y = Var_visitedPageCount.getValue();
var progress = Math.round(y/x*100);
document.getElementById('pct').innerHTML = progress+'%';
document.getElementById('radial').classList.add('p'+progress);
});
答案 0 :(得分:0)
您需要setTimeout()
函数:
document.addEventListener("DOMContentLoaded", function(event) {
console.log( "Loaded at " + performance.now() );
setTimeout(function() {
//Your code
console.log( "I'm ready at " + performance.now() );
}, 3000); // 3000 milliseconds = 3 sec
});