-
-
Save slattery/11275991 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> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> | |
<style type="text/css"> | |
body { | |
margin: 40px; | |
font: 14px Helvetica Neue; | |
} | |
div { | |
position: relative; | |
overflow: hidden; | |
} | |
span { | |
display: inline-block; | |
position: absolute; | |
height: 16px; | |
} | |
.progress { | |
border: solid 1px #ccc; | |
background: #eee; | |
} | |
.progress .value { | |
background: #3182bd; | |
} | |
</style> | |
</head> | |
<body> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.7.0"></script> | |
<script type="text/javascript"> | |
var id = 0xffff; | |
function create() { | |
var duration = 5000 + Math.random() * 25000; | |
var div = d3.select("body").insert("div", "div"); | |
div.append("span") | |
.style("width", "74px") | |
.style("text-align", "right") | |
.text(++id); | |
div.append("span") | |
.attr("class", "progress") | |
.style("width", "240px") | |
.style("left", "80px") | |
.append("span") | |
.attr("class", "value") | |
.transition() | |
.duration(duration) | |
.ease("linear") | |
.style("width", "100%"); | |
div.transition() | |
.style("height", "20px") | |
.transition() | |
.delay(duration) | |
.style("height", "0px") | |
.remove(); | |
setTimeout(create, Math.random() * 10000); | |
} | |
create(); | |
create(); | |
create(); | |
create(); | |
create(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment