nuContextMenu 是用在 Web 应用上,对字体有完美支持的内容菜单。它只有 2.2 KB 大小,它将菜单视为主要对象,这就意味着单个菜单可以附着多个元素。
示例代码:
$(function() { var context = $('#node').nuContextMenu({ // Omit items if you are attaching to a single container items: '.item', callback: function(key, element) { alert('Clicked ' + key + ' on ' + $(element).attr('id')); }, // Define menu items here // key: {...} menu: { 'archive': { title: 'Archive', // Font awesome icons here icon: 'archive', }, 'mark': { title: 'Mark as read', icon: 'check', }, // If the value is 'separator' then an // <hr> node is added 'void': 'separator', 'delete': { title: 'Delete', icon: 'trash', }, } }); // Disable context menu // context.nuContextMenu('disable'); });