D3
OG
Old school D3 from simpler times
All examples
By author
By category
About
mbostock
Full window
Github gist
Countdown
<!DOCTYPE html> <meta charset="utf-8"> <style> #countdown { font: 100px/500px Menlo; text-align: center; width: 960px; } </style> <div id="countdown"></div> <script src="//d3js.org/d3.v3.min.js"></script> <script> var formatTime = d3.time.format("T-%X"), countdown = d3.select("#countdown"), today = d3.time.day(new Date); // 9 AM tomorrow var deadline = d3.time.day.offset(today, 1); deadline.setHours(9); (function tick() { var now = new Date; countdown.text(formatTime(new Date(+today + +deadline - d3.time.second(now)))); setTimeout(tick, 1000 - now % 1000); })(); </script>
https://d3js.org/d3.v3.min.js