How can I make double click event on node in d3.js?

前端 未结 2 1773
误落风尘
误落风尘 2021-02-03 19:00

I want to make double click event on nodes. So I tried

.on(\"dbclick\",function(d){return \"http://google.com\");});

and

.bin         


        
2条回答
  •  一生所求
    2021-02-03 19:39

    If using D3 Observable:

    const nodeEnter = node.enter().append("g")
            .on("dblclick", d => {
              d3.event.preventDefault();
              // do your thing
            });
    

提交回复
热议问题