拉斐尔JS事件没有解雇

时间:2015-03-24 19:02:53

标签: javascript node.js user-interface backbone.js raphael

我有一个Raphael.js图标,我试图附加一个点击甚至监听器。当我自动触发该函数时(使用闭括号()),控制台日志成功。但是,我不能在没有自动执行该功能的情况下触发事件。变换的已知错误/问题是否将渲染路径放在页面的其他位置?我在这里倾注评论,如果有人看到类似的问题请发帖。

              var paper3 = Raphael($("#mail").get(0), 175, 75);
              var iconPath3 = paper3.path(iconPath);
              iconPath3.transform("s1.3, t0,5");
              iconPath3.attr("fill","fff");
              iconPath3.click(function(e) {
                  console.log("Test");
              });

1 个答案:

答案 0 :(得分:0)

您可以尝试在jQuery对象中包装iconPath3:

$(iconPath3).click(function(e){
     console.log("Logging event: ", e);
});

另外,您是否尝试使用JavaScript对象设置填充:

iconPath3.attr({fill: '#fff'});

希望有所帮助。

相关问题