这是一个 jQuery 用来显示上下文菜单(响应鼠标右键)的插件
示例代码:
$(document).ready( function() {
$(“#selector”).contextMenu({ menu: ‘myMenu’ }, function(action, el, pos) { alert( ‘Action: ‘ + action + ‘nn’ + ‘Element ID: ‘ + $(el).attr(‘id’) + ‘nn’ + ‘X: ‘ + pos.x + ‘ Y: ‘ + pos.y + ‘ (relative to element)nn’ + ‘X: ‘ + pos.docX + ‘ Y: ‘ + pos.docY+ ‘ (relative to document)’ ); }); });