I am trying to mount a load bar that starts after 2 seconds of loading document
, It every 100
milliseconds gets 1%
width
. However, when the page loads, console.log () shows that the function is running, but nothing happens. How can I fix the problem?
$(document).ready(function(){
setTimeout(function(){
var count = 0;
while(count < 100){
setTimeout(function(){
$("#loader-progress").css({"width":count + "%"})
},500)
count++;
}
},2000);
});