Skip to content

Instantly share code, notes, and snippets.

@bmschmidt
Last active August 29, 2015 14:07
Show Gist options
  • Save bmschmidt/cc815e1734d048a9312a to your computer and use it in GitHub Desktop.
Save bmschmidt/cc815e1734d048a9312a to your computer and use it in GitHub Desktop.
reveal.js bookworm plugin code
d3.selectAll("code")
.filter(function(d) {
try {JSON.parse(d3.select(this).text());
return true }
catch(exception) {
return false}})
.each(function(d) {
d3.select(this).on("click",function() {
var pbookworm = Bookworm(JSON.parse(d3.select(this).text()));
d3.selectAll("#bookworm").remove();
d3.select(".reveal.fade").append('div').style("position","absolute")
.style("visibility","visible").style("background","tan").style("opacity",1).attr("id","bookworm").attr("class","reveal").style("z-index",10000).on("click",function(d) {d3.select("#bookworm").transition().style("opacity",0).remove()})
.append("svg").attr("id","svg").style("width",1000).style("height",1000).style("color","black").style("fill","black").style("position","absolute")
.style("visibility","visible").style("opacity",1)
pbookworm.updatePlot()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment