简体   繁体   English

使用SVG元素初始化Raphael

[英]Initializing Raphael with an svg element

I have already an SVG element on my HTML page. 我的HTML页面上已经有一个SVG元素。 How can I initialize Raphael with it so that it wont create a new SVG, but use the one I provide. 我如何用它初始化Raphael,以便它不会创建新的SVG,而是使用我提供的SVG。

Thanks 谢谢

I don't think Raph will allow you to do this. 我认为Raph不会允许您这样做。 I think you will need to give it a div or container that Raph will place the svg/vml place inside. 我认为您需要给它一个div或容器,Raph会将svg / vml放置在其中。 I don't think you can give it an existing element to use (as svg). 我认为您不能给它提供一个现有元素(如svg)。

I suspect this is because Raphael does not only create SVG, but possibly VML if its one of the very old browser versions. 我怀疑这是因为Raphael不仅会创建SVG,而且可能会创建VML(如果它是非常老的浏览器版本之一)。 If you definitely need SVG and want to only use existing elements, you may want to look at Snap.svg, which is Raphaels younger sister (and shares a lot of the same codebase), or another like SVG.js. 如果您确实需要SVG并只想使用现有元素,则可以查看Snap.svg,它是Raphaels的妹妹(并共享许多相同的代码库),或诸如SVG.js的另一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM