jQuery SVG resize an object to size of container
I am loading an Image in jQuery SVG.
Here is the code that I am using to add Image object to SVG canvas:
- var svg = $('#svgphone').svg('get');
- var img = svg.image(0, 0, 330, 450, 'images/img1.jpg', {id: 'img'});
svg.title(img, 'img1');
Here I have to give location and size of object that I am loading. But before I give the size I want to resize the object so that it fits within the container while maintaining it its proportions.
Here is the HTML part:
- <div id="svgphone" style="width:330px; height:540px"></div>
But I cannot get this to work properly.
Please help.
TIA
Yogi Yang