Javascript 是否可以将Jcrop与jQuery contextMenu结合使用?

Javascript 是否可以将Jcrop与jQuery contextMenu结合使用?,javascript,jquery,html,contextmenu,jcrop,Javascript,Jquery,Html,Contextmenu,Jcrop,我尝试了一些简单的实现(例如,鼠标向上移动,启用上下文菜单),但它似乎不能以这种方式工作。这可能是zIndex的问题吗 $(function($) { $('#test').Jcrop({ aspectRatio: 1, maxSize: [64, 64], onSelect: testFunc }); }); function testFunc() { console.log("onSelect - testFunc()

我尝试了一些简单的实现(例如,鼠标向上移动,启用上下文菜单),但它似乎不能以这种方式工作。这可能是zIndex的问题吗

$(function($) {
    $('#test').Jcrop({
        aspectRatio: 1,
        maxSize: [64, 64],
        onSelect: testFunc
    });
});

function testFunc() {
    console.log("onSelect - testFunc()");
    $.contextMenu({
        selector    : '#test',
        items       : {
            "edit": {name: "Edit", icon: "edit"},
            "cut": {name: "Cut", icon: "cut"}
       }
    });
    console.log("contextMenu"); // Appears to be called but the contextmenu does not appear
}
看看这个

jQuery contextMenu插件创建了一个右键单击时显示的上下文菜单。如果您想让它与JCrop一起工作,您需要禁用默认触发器(右键单击),并从jcroponselect中手动显示contextMenu

$(function($) {
  $('#test').Jcrop({
    aspectRatio: 1,
    maxSize: [64, 64],
    onSelect: testFunc
  });

  $.contextMenu({
    selector    : '#test',
    trigger     : 'none', // disable right click trigger
    items       : {
      "edit": {name: "Edit", icon: "edit"},
      "cut": {name: "Cut", icon: "cut"}
    }
  });
});

function testFunc() {
  // Manually display ContextMenu from registered selector
  $('#test').contextMenu();
}

谢谢你的即兴创作。此后,我做了一些调整,以在鼠标光标下方而不是在div外部创建ContextMenu。但是,ContextMenu的zIndex遇到了一些问题。看这个。当ContextMenu的zIndex大于JCrop时,JCrop似乎不再识别onRelease。