使用 phonejs 制作移动应用程序,我正在使用强力布局 d3.js 。我希望在 d3 的节点被双击或按住时添加一些功能。 但双击事件在手机中没有任何作用。我也尝试过jQuery touch事件,但在这里没有用。 如何将触摸事件放在 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);
});