$("#element").bind("keydown", function(e) {
if (e.which === 39) { //if keyboard right arrow
$("#element").trigger({
type: 'mousedown',
button: 2
}).trigger({
type: 'mouseup'
});
$("#element").bind('mousedown', function(ev) {
if (ev.which === 2) {
//call method - I need pageX and pageY coordinates
//methods.show.apply($this, [ev.pageX, ev.pageY, options.showAnimation]);
alert("called");
}
});
}
});
我要做的是:按键盘右箭头键,然后模拟鼠标右键单击触发器,现在我需要一个处理程序,这样我就可以启动需要 X 和 Y 坐标的上下文菜单。