【问题标题】:Apply dxhold/touch event of phonejs on d3 node在 d3 节点上应用 phonejs 的 dxhold/touch 事件
【发布时间】:2014-03-18 05:56:24
【问题描述】:

使用 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);
       });

【问题讨论】:

标签: d3.js phonejs


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-28
    • 2022-07-31
    • 1970-01-01
    相关资源
    最近更新 更多