Created
September 24, 2019 00:32
-
-
Save brydavis/d24b2c6401ef28ddf0f6edbeab8542b3 to your computer and use it in GitHub Desktop.
Progress Bar Snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pb is a DIV that respresents the progress bar itself | |
// this example is a demo; update it to track actually progress | |
function move(pb) { | |
pb.style.width = "0%" | |
setTimeout(function () { | |
console.log("start") | |
var width = 1; | |
var id = setInterval(frame, 50); | |
function frame() { | |
if (width >= 100) { | |
clearInterval(id); | |
console.log("done") | |
} else { | |
width++; | |
pb.style.width = width + '%'; | |
} | |
} | |
}, 1000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment