ttothec
ttothec

Reputation: 343

need help placing JS code result/return inside div

I found this jsfiddle online that does exactly what I've been looking for... the problem is is that it creates the visual using pure JS. I wanted to put that inside a div so I could control it... Like defining exact placement, margins, adding opacity, etc...

Here's the jsfiddle: http://jsfiddle.net/7jHPv/52/

Right now "I'm" placing the visual on the page through the JS code itself, wondering how I can "load it" inside that container div.

So, taking the example on the jsfiddle, instead of being at the position given by the code, make it follow the margins I attributed to the container div... by putting it inside the div.

I see this:

return {
   path: path
};

Can I change the return there to "add it" to the container div? Or something...

Thanks!

Upvotes: 2

Views: 46

Answers (1)

Peter Elliott
Peter Elliott

Reputation: 3322

instead of

var paper = new Raphael(100, 300, 0, 100, side);

make the definition

var paper = new Raphael("container", 100, side);

where container is the name of your div. From there you can control the div's location, margins/padding and whatever else

Upvotes: 1

Related Questions