Hi,
Can anyone tell me the correct way to get the size of the SVG container?
I have the following HTML
<div id="myContainer" style="width: 900px; height: 100px" />
and the following Javascript:
function initViewer(elementId) {
var element, elementRef, snap;
elementRef = '#' + elementId;
element = $(elementRef);
element.append('<svg style="width: ' + element.width() + 'px; height: ' + element.height() + 'px; border: solid 1px black;"/>');
snap = Snap(elementRef + ' svg');
console.log(snap.getBBox());
}
initViewer('myContainer')
The border on the SVG shows that it is being rendered at the dimensions asked for (verified in Chrome and Safari on MacOS X), but getBBox() returns '0' for all its attributes. I can't seem to see a reliable way to get the container's dimensions? I would the dimensions, so I can draw using the appropriate bounding dimensions.
Any suggestions?
Andre