Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Created April 28, 2016 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaizemberg/6d57e8db1b2007a4c9bb36e08d23c929 to your computer and use it in GitHub Desktop.
Save aaizemberg/6d57e8db1b2007a4c9bb36e08d23c929 to your computer and use it in GitHub Desktop.
slider / gauge
<!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