我添加
d3.behavior.zoom().on("zoom", redraw);
现在节点上的click事件在IE9中不起作用。
var nodeEnter = node.enter().append("g")
.attr("class", "node")
.attr("transform", function(d) { return "translate(" + source.y0 + "," + source.x0 + ")"; })
.on("click", click, true);
如何让Click事件在IE9中正常运行?
//延
答案 0 :(得分:3)
通过覆盖mouseup.zoom(在mousemove上)我能够在IE9中保留点击事件。
var pan = svg.append("g")
.attr("transform", "translate(" + panTranslate + ")")
.call(d3.behavior.zoom().on("zoom", function(d){
panTranslate[0] += d3.event.translate[0];
panTranslate[1] += d3.event.translate[1];
pan.attr("transform", "translate(" + panTranslate + ")");
d3.select(window).on("mouseup.zoom", function(){
d3.select(window).on("mousemove.zoom", null).on("mouseup.zoom", null);
});
return true;
})).on("dblclick.zoom", null);