Skip to content

Instantly share code, notes, and snippets.

@ironsmile
Created September 26, 2013 14:42
Show Gist options
  • Save ironsmile/6715177 to your computer and use it in GitHub Desktop.
Save ironsmile/6715177 to your computer and use it in GitHub Desktop.
HTML 5 progress example
<!DOCTYPE html>
<html>
<header></header>
<body>
<progress value="5" max="13" id="prog"></progress>
<script>
_t = null;
function progress () {
if (_t) {
clearTimeout(_t);
};
var el = document.getElementById('prog');
var new_val = el.value + 1;
if (new_val >= el.max) {
new_val = el.max;
};
el.value = new_val;
if (el.value < el.max) {
_t = setTimeout(function () { progress(); }, 1000);
};
}
progress();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment