【问题标题】:Jstree call event when context menu is shown and hidden显示和隐藏上下文菜单时的 Jstree 调用事件
【发布时间】:2016-03-22 13:13:59
【问题描述】:

当上下文菜单显示并隐藏时,我试图调用一些 javascript 代码(当我右键单击并出现上下文菜单时显示;当我在上下文菜单之外单击时它会从页面)。我尝试了以下操作,但事件从未被触发。

// Create instance for tree
$(function () {
    $('#myTree').jstree({
        "core": {
            "themes": {
                'name': 'default',
                "variant": "small",
                "icons": false
            }
        },
        "contextmenu": {
            "items": getMenu(),
            "select_node": false
        }
        ,"plugins": ["contextmenu"]
    });

});

// when context menu is shown
$("#myTree").bind('context_show.vakata', function (reference, element, position) {

    // code to do...
});

// when context menu is hidden
$("#myTree").bind('context_hide.vakata', function (reference, element, position) {

    // code to do...
});

根据API,语法看起来是正确的。请帮助我做错了什么。

【问题讨论】:

    标签: javascript jquery contextmenu jstree


    【解决方案1】:

    正如 API 所说 - 事件是在文档上触发的,所以替换: $("#myTree").bind$(document).bind

    最好的问候, 伊万

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-25
      • 2017-07-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多