Cipher
Cipher

Reputation: 6092

Adding HTML inside RaphaelJS elements

I am creating a circle inside my html page using the following simple code of RaphaelJS. I wanted to ask if there's some way by which I could add my own html inside the circle that I just drew with Raphael.

Adding text inside the object looks possible with absolute positioning, but how do I add my own html such as div, images, or other things inside the circle (or a rectangle etc.) preferably without absolute positioning.

Upvotes: 2

Views: 2837

Answers (1)

hackick7
hackick7

Reputation: 9

Take a look at RaphaelJS-Infobox :

This is a simple JS helper that automates placement of HTML elements inside of RaphaelJS Containers.

Please test and let me know, this is a simple example:

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>');

Hope this help enough.

Upvotes: 1

Related Questions