Skip to content

Instantly share code, notes, and snippets.

@ryanpitts
Created December 12, 2013 23:44
Show Gist options
  • Save ryanpitts/7937646 to your computer and use it in GitHub Desktop.
Save ryanpitts/7937646 to your computer and use it in GitHub Desktop.
Mike Bostock tip on moving elements in front of siblings. https://groups.google.com/forum/#!msg/d3-js/eUEJWSSWDRY/EMmufH2KP8MJ
d3.selection.prototype.moveToFront = function() {
return this.each(function() {
this.parentNode.appendChild(this);
});
};
Then you can say:
d3.select("p").moveToFront().style("color", "red");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment