External SVG In Multipile Nodes
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
license: gpl-3.0 |
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> | |
<meta charset="utf-8"> | |
<body> | |
<div class="container"></div> | |
<div class="container"></div> | |
<div class="container"></div> | |
<div class="container"></div> | |
<div class="container"></div> | |
<script src="https://d3js.org/d3.v4.js"></script> | |
<script> | |
d3.xml("rect01.svg").mimeType("image/svg+xml").get(function(error, xml) { | |
if (error) throw error; | |
var el = xml.documentElement; | |
document.querySelectorAll(".container").forEach((container, container_index) => { | |
container.appendChild(el.cloneNode(true)); | |
}); | |
}); | |
</script> | |
</body> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment