Created
September 26, 2013 14:42
-
-
Save ironsmile/6715177 to your computer and use it in GitHub Desktop.
HTML 5 progress example
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
<!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