copy of the 2011/09 talk by Mike Bostock; very minor tweaks to make it run with the latest d3.v2.js in this gist setting.
xxxxxxxxxx
<!-- saved from url=(0047)https://mbostock.github.com/d3/talk/20110921/#15 -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>D3.js</title>
<script type="text/javascript" src="https://d3js.org/d3.v2.js"></script>
<style type="text/css">
body {
background: #000;
position: relative;
width: 1280px;
height: 800px;
margin: auto;
overflow: hidden;
}
iframe {
border: none;
position: absolute;
width: 1280px;
height: 800px;
background: #fff;
-moz-transition-property: -moz-transform, opacity;
-moz-transition-duration: 500ms;
-webkit-transition-property: -webkit-transform, opacity;
-webkit-transition-duration: 500ms;
}
#about {
font: 14px "Helvetica Neue";
position: absolute;
width: 1280px;
top: 840px;
}
#about, #about a {
color: #fff;
}
#previous {
opacity: 0;
-moz-transform: translateX(-1300px);
-webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1300, 0, 0, 1);
}
#current {
opacity: 1;
-moz-transform: translateX(0);
-webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
}
#next {
opacity: 0;
-moz-transform: translateX(1300px);
-webkit-transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1300, 0, 0, 1);
}
</style>
</head>
<body style="margin-top: 26.666666666666668px; ">
<iframe id="previous" src="./foci.htm"></iframe>
<iframe id="current" src="./more-foci.htm"></iframe>
<iframe id="next" src="./link-foci.htm"></iframe>
<div id="about">
Video: <a href="https://vimeo.com/29458354">https://vimeo.com/29458354</a><br>
Source: <a href="https://github.com/mbostock/d3">https://github.com/mbostock/d3</a>
</div>
<script type="text/javascript">
var slides = [
"overview.html",
"force.html",
"patent-suits.html",
"static.html",
"momentum.html",
"verlet.html",
"negative-charge.html",
"positive-charge.html",
"gravity.html",
"gravity-charge.html",
"links.html",
"relaxation.html",
"ribbon.html",
"transition.html",
"foci.html",
"more-foci.html",
"link-foci.html",
"medals.html",
"states.html",
"quantitative-foci.html",
"tree.html",
"parent-foci.html",
"depth-foci.html",
"collision.html",
"bounding.html",
"labels.html",
"collapsible.html",
"builder.html"
];
var previous = d3.select("#previous"),
current = d3.select("#current"),
next = d3.select("#next"),
query = "?" + Date.now(),
previousIndex,
currentIndex = +location.hash.substring(1) || 0,
nextIndex;
resize();
step(0);
d3.selectAll("iframe").on("load", function() {
this.contentWindow.focus();
d3.select(this.contentWindow).on("keydown", function() {
switch (d3.event.keyCode) {
case 39: // right arrow
case 32: // space
case 34: { // page down
step(+1);
break;
}
case 8: { // delete
step(d3.event.shiftKey ? +1 : -1);
break;
}
case 37: // left arrow
case 33: { // page up
step(-1);
break;
}
case 36: { // home
currentIndex = 0;
step(0);
break;
}
case 35: { // end
currentIndex = slides.length - 1;
step(0);
break;
}
default: return;
}
d3.event.preventDefault();
});
});
d3.select(window).on("resize", resize).on("hashchange", function hashchange() {
var that = d3.select(this).on("hashchange", null);
currentIndex = +location.hash.substring(1);
step(0);
that.on("hashchange", hashchange);
});
function resize() {
d3.select("body").style("margin-top", (window.innerHeight - 800) / 3 + "px");
}
function step(delta) {
if (delta > 0) {
var temp = previous;
previousIndex = currentIndex;
previous = current.attr("id", "previous");
currentIndex = nextIndex;
current = next.attr("id", "current");
nextIndex = nextIndex >= slides.length - 1 ? 0 : nextIndex + 1;
next = temp.attr("id", "next");
} else if (delta < 0) {
var temp = next;
nextIndex = currentIndex;
next = current.attr("id", "next");
currentIndex = previousIndex;
current = previous.attr("id", "current");
previousIndex = previousIndex <= 0 ? slides.length - 1 : previousIndex - 1;
previous = temp.attr("id", "previous");
} else {
nextIndex = currentIndex >= slides.length - 1 ? 0 : currentIndex + 1;
previousIndex = currentIndex <= 0 ? slides.length - 1 : currentIndex - 1;
}
previous.transition().delay(750).attr("src", slides[previousIndex] + query);
current.transition().delay(250).attr("src", slides[currentIndex] + query);
next.transition().delay(750).attr("src", slides[nextIndex] + query);
location.hash = currentIndex;
}
</script>
</body></html>
Modified http://d3js.org/d3.v2.js to a secure url
https://d3js.org/d3.v2.js