2

我正在使用以下简单的 RaphaelJS 代码在我的 html 页面内创建一个圆圈。我想问是否有某种方法可以在我刚刚用 Raphael 绘制的圆圈内添加我自己的 html。

在对象内添加文本看起来可以使用绝对定位,但我如何在圆(或矩形等)内添加我自己的 html,例如 div、图像或其他东西,最好不要使用绝对定位。

4

1 回答 1

1

看看RaphaelJS-Infobox

这是一个简单的 JS 助手,可以自动在 RaphaelJS 容器中放置 HTML 元素。

请测试并告诉我,这是一个简单的例子:

var paper = Raphael("raphael-canvas", 500, 500);
var infobox = new Infobox(paper, {x:10,y:10, width:250, height:250});
infobox.div.html('<p>This is some crazy content that goes inside of that box that will wrap around.</p>');

希望这有足够的帮助。

于 2013-01-22T08:31:27.073 回答