Chr*_*che 5 javascript svg contextmenu right-click d3.js
我想在右键单击svg圆圈时出现自定义上下文菜单.现在我找到了这个答案,帮助我使用以下代码处理右键单击:
.on("contextmenu", function(data, index) {
//handle right click
//stop showing browser menu
d3.event.preventDefault()
});
Run Code Online (Sandbox Code Playgroud)
现在我想知道如何显示包含一些HTML的框.
提前致谢.
mee*_*mit 11
d3.select('#stock_details .sym').on("contextmenu", function(data, index) {
var position = d3.mouse(this);
d3.select('#my_custom_menu')
.style('position', 'absolute')
.style('left', position[0] + "px")
.style('top', position[1] + "px")
.style('display', 'block');
d3.event.preventDefault();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14147 次 |
| 最近记录: |