jQuery右键菜单ContextMenu详细使用

Example code: Simple Context Menu

$(function(){
    $.contextMenu({
        selector: '.context-menu-one', 
        callback: function(key, options) {
            var m = "clicked: " + key;
            window.console && console.log(m) || alert(m); 
        },
        items: {
            "edit": {name: "Edit", icon: "edit"},
            "cut": {name: "Cut", icon: "cut"},
            "copy": {name: "Copy", icon: "copy"},
            "paste": {name: "Paste", icon: "paste"},
            "delete": {name: "Delete", icon: "delete"},
            "sep1": "---------",
            "quit": {name: "Quit", icon: "quit"}
        }
    });
    
    $('.context-menu-one').on('click', function(e){
        console.log('clicked', this);
    })
});

 

Example HTML: Simple Context Menu

 

<div class="context-menu-one box menu-1">
    <strong>right click me</strong>
</div>

 

官网:http://medialize.github.io/jQuery-contextMenu/demo.html

下载:https://github.com/medialize/jQuery-contextMenu

你可能感兴趣的:(contextMenu)