I just opened Raphael and love him, but I don't really like javascript-er. Right now I have three repeating code snippets for drawing one circle in three different divs. By default, to create a canvas in Raphael, an element by identifier is found, but I want one set of variables to have circles drawn in all divs with the class "circle". I think there should be a more efficient way to code this. Here is the code I'm using now:
window.onload = function () {
var paper = Raphael("c1", 26, 26);
var circle = paper.circle(13, 13, 10.5);
circle.attr("stroke", "#f1f1f1");
circle.attr("stroke-width", 2);
var text = paper.text(13, 13, "1");
text.attr({'font-size': 15, 'font-family': 'FranklinGothicFSCondensed-1, FranklinGothicFSCondensed-2'});
text.attr("fill", "#f1f1f1");
var paper2 = Raphael("c2", 26, 26);
var circle2 = paper2.circle(13, 13, 10.5);
circle2.attr("stroke", "#f1f1f1");
circle2.attr("stroke-width", 2);
var text2 = paper2.text(12, 13, "2");
text2.attr({'font-size': 15, 'font-family': 'FranklinGothicFSCondensed-1, FranklinGothicFSCondensed-2'});
text2.attr("fill", "#f1f1f1");
var paper3 = Raphael("c3", 26, 26);
var circle3 = paper3.circle(13, 13, 10.5);
circle3.attr("stroke", "#f1f1f1");
circle3.attr("stroke-width", 2);
var text3 = paper3.text(12, 13, "3");
text3.attr({'font-size': 15, 'font-family': 'FranklinGothicFSCondensed-1, FranklinGothicFSCondensed-2'});
text3.attr("fill", "#f1f1f1");
};
Test site @ http://jesserosenfield.com/fluid/test.html
Many thanks for your help!