在jQuery中SVG插件(http://plugins.jquery.com/project/svg)与SVG工作执行从DIV元素开始和创建div中新的SVG对象:SVG通过jQuery.svg
Attach an SVG canvas to a with the following:
$(selector).svg();
是否有可能与连接jquery到现有的svg对象?如果“是”如何做到这一点?
编辑: 司机小费
<body onload="alert('loaded');testSvg();">
<div id="div3" style="border: solid 1px black; width:200px; height:100px">
<svg id="svg3" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
</div>
<script type="text/javascript">
function testSvg() {
var svgRootElement = $("#svg3").get();
var svgWrapper = new $.svg._wrapperClass(svgRootElement);
svgWrapper.circle(30, 25, 50, { fill: 'red' });
}
导致错误:
'TypeError: Unable to get value of the property 'createElementNS': object is null or undefined' error...
为什么呢?
我建议你出打破编辑成新问题。我对如何回答这个问题有了一个想法,但是在这里回答它会太混乱。 – jbeard4 2011-05-15 21:14:33
完成:http://stackoverflow.com/questions/6033939/how-to-create-jquery-wrapper-on-existing-svg-object – Budda 2011-05-17 16:19:15