block by pnavarrc 5067fbc05422445cf60d

5067fbc05422445cf60d

Full Screen

Inserting SVG in the DOM

Inserting SVG images as DOM nodes instead of inserting them as images or objects. In this example, we load an image stored as JST templates and insert the image into the DOM, allowing to modify its style via CSS and its attributes with JavaScript.

In this gist, we change the whale color and make it move using D3.

Whale

References

index.html

templates.js

whale.svg