我尝试将上下文菜单绑定到我的 jsTree。
我添加了contextmenu插件,但右键单击时未显示菜单。于是我调试了渲染上下文菜单的函数,发现菜单元素的高度和宽度都是0。我也在这个页面上调试了一个例子,发现高度和宽度都是正数。
// Height and width are 0 in my app and jsTree example.
$.vakata.context.cnt
.html(html) // Default menu, so HTML in my app and in example are the same.
.css({ "visibility" : "hidden", "display" : "block", "left" : 0, "top" : 0 });
...
h = $.vakata.context.cnt.height(); // 0 in my app, > 0 in example.
w = $.vakata.context.cnt.width(); // 0 in my app, > 0 in example.
什么是可能的原因?
解决
当应用程序初始化时,它会清理为显示上下文菜单而创建的 jsTree。
不好意思,打扰了。