0

使用phonejs制作移动应用程序,我使用d3.js和强制布局。当d3的节点被双击或按住时,我想添加一些功能。但是双击事件在手机中没有任何作用。我也尝试了 jQuery 触摸事件,但在这里不起作用。如何将触摸事件放在d3的节点上?

这是节点:

node = container.append("g").selectAll("image.node")
      .data(nodes_edges_json.nodes)
      .enter().appent("g").append("svg:image")
      .attr("class", "node")
      .attr("xlink:href", function(nodeObj) { return setImage(nodeObj); })
      .attr("width", function(nodeObj) { return setHeightWidth(nodeObj); })
      .attr("height", function(nodeObj) { return setHeightWidth(nodeObj); })
      .on("dblclick", function(data, index) {
           d3.event.preventDefault();
           getdata(data, index);
       });
4

1 回答 1

0

我建议您查看http://eightmedia.github.io/hammer.js/我有同样的问题,不得不反对使用 dxhold 选项。锤子工作得很好。

于 2014-03-31T20:19:09.943 回答