Created
April 28, 2016 01:19
-
-
Save aaizemberg/6d57e8db1b2007a4c9bb36e08d23c929 to your computer and use it in GitHub Desktop.
slider / gauge
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> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>slider</title> | |
</head> | |
<body> | |
<input type="range" min="0" max="100" value="0"> | |
<script> | |
var timer = setInterval(update, 1000); | |
var n = 0; | |
function update() { | |
n += 10; | |
d3.select("input").attr("value",n); | |
console.log(n); | |
if (n == 100) { | |
clearInterval(timer); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment