Rafael js, how to include multiple icons on the site? with class instead of ID

How can I add multiple shortcuts from Raphaël ( http://raphaeljs.com/icons/ ) on one site?

I was not able to enable them using the class = "icon, only with id =" icon. "Since I am not so good at JavaScript, I searched the Internet but found nothing.

The only thing I found on the blog:

    bubble: "M16,5.333c-7.732,0-14,4.701-14,10.5c0,1.982,0.741,3.833,2.016,5.414L2,25.667l5.613-1.441c2.339,1.317,5.237,2.107,8.387,2.107c7.732,0,14-4.701,14-10.5C30,10.034,23.732,5.333,16,5.333z",

a = j[b]("column-1")[f]("h2");
for (var z = a.length; z--;) {
   l = a[z];
   l && g(l[f](i)[0], 32, 32).path(k.bubble).attr(m);
}

.js http://dmitry.baranovskiy.com/site2.js

Blog http://dmitry.baranovskiy.com/

Because he uses a “bubble” in the gap before each message.

Is there a way to include it with a class instead of an ID? This is how I enable it through ID

var example = Raphael("example", 50, 60);
example.path("icon-string").attr({fill: "#fff", stroke: "#333"});

and then turn it on

<span id="example">
+5
source share
1 answer

, :

var elements = document.querySelectorAll('.paper');
for (i=0; i<elements.length; i++) {
    paper = Raphael(elements[i], 50, 50)
    paper.path(bubble).attr({"fill": "#333"})
}

jQuery, IE 6 7

$('.paper').each(function(i){
        paper = Raphael($(this)[0], 50, 50)
        paper.path(bubble).attr({"fill": "#333"})
})

: http://jsfiddle.net/CHEP9/

+7

All Articles