diff --git a/Create-document.md b/Create-document.md new file mode 100644 index 0000000..2978f64 --- /dev/null +++ b/Create-document.md @@ -0,0 +1,35 @@ +Use the `SVG()` function to create a SVG document within a given html element: + +```javascript +var draw = SVG('canvas').size(300, 300) +var rect = draw.rect(100, 100).attr({ fill: '#f06' }) +``` +The first argument can either be an id of the element or the selected element itself. +This will generate the following output: + +```html +
+ + + +
+``` + +By default the svg canvas follows the dimensions of its parent, in this case `#canvas`: + +```javascript +var draw = SVG('canvas').size('100%', '100%') +``` + +## Checking for SVG support + +By default this library assumes the client's browser supports SVG. You can test support as follows: + +```javascript +if (SVG.supported) { + var draw = SVG('canvas') + var rect = draw.rect(100, 100) +} else { + alert('SVG not supported') +} +``` \ No newline at end of file