Skip to content

Instantly share code, notes, and snippets.

@lmullen
Created December 16, 2014 22:23
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 lmullen/1129f11f06ed7c282644 to your computer and use it in GitHub Desktop.
Save lmullen/1129f11f06ed7c282644 to your computer and use it in GitHub Desktop.
Simple counter
<style>
#counter {
width:100%;
height:100%;
font-size:400px;
text-align:center;
padding-top:40px;
overflow:hidden;
}
::selection {
background: transparent;
}
body {
overflow:hidden;
}
</style>
<div id="counter">0</div>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script>
var counter = d3.select("#counter")
counter.on("click", count);
var val = 0;
function count() {
val++
counter.text(val);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment