Last active
March 28, 2016 01:44
-
-
Save SamSamskies/818d0e7c665995ebd06b 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Blank HTML 5 Template</title> | |
<style> | |
#progress-bar { | |
width: 0; | |
height: 50px; | |
background-color: black; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="progress-bar"></div> | |
<button id="start">Start</button> | |
<button id="stop">Stop</button> | |
<button id="reset">Reset</button> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script> | |
<script> | |
var $progressBar = $('#progress-bar'); | |
var DURATION = 5000; // in miliseconds | |
$('#start').click(() => $progressBar.animate({ width: '100%'}, DURATION)); | |
$('#stop').click(() => $progressBar.stop()); | |
$('#reset').click(() => { | |
var clearQueue = true; | |
$progressBar.stop(clearQueue).animate({ width: 0 }); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment