其次,我有一个使用raphaeljs lib的不同路径的SVG窗体转换。
我想通过调用raphaeljs 2.1.0 => getById(id)的函数来获得路径。
但Chrome或Firefox告诉我,没有函数getById!我不明白为什么?function getById Raphael js
这一块我的代码:
rsrGroups = [path_c_trsp,path_i_trsp,path_l_trsp,path_o_trsp];
len = rsrGroups.length;
for(var i = 0; i < len; i++){
var el = rsrGroups[i];
el.mouseover(function() {
rsrGroupsMin.forEach(function(el){
var getPath = el.getById('el.id'); // here is the method called !
alert(getPath);
el.animate({opacity: 0.5},350,function() {});
rsrGroups2.forEach(function(tri){
tri.animate({opacity: 0.5},350,function() {});
});
});
this.animate({opacity: 1},350,function() {});
});
}
这是由Chrome给出的错误:
Uncaught TypeError: Object Raphaël’s object has no method 'getById'
我尝试不同的事情,但没有一件作品:/
谢谢你,我在看完我的代码后自己找到它^^ 我必须做var getPath = ** rsr **。getById(this.id); – Glou94