Last active
June 2, 2016 21:34
-
-
Save mlent/1dcc06cb875089ed74eea6c4f00b9a5e to your computer and use it in GitHub Desktop.
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
<script> | |
var btn = document.getElementById('myButton'); | |
btn.addEventListener('click', loadProgress); | |
function loadProgress() { | |
console.log('Button clicked!'); | |
var progressBar = document.getElementsByClassName('progress-bar')[0]; | |
var interval = 30; | |
var currentValue = 0; | |
for (var i = 0; i < 100; i += interval) { | |
console.log('Setting interval', i) | |
setTimeout(function() { | |
currentValue += i; | |
console.log('Setting progress width to:', currentValue, '%'); | |
progressBar.setAttribute('style', 'width: ' + currentValue + '%'); | |
}, i); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment