如何在jquery ContextMenu中绑定静态ul li?

时间:2016-08-02 13:48:45

标签: jquery contextmenu

$(function() {
    $.contextMenu({
        selector: '.projects-dropdown',
        callback: function(key, options) {
            var m = "clicked: " + key;
            window.console && console.log(m) || alert(m);
        },
        items: {
            "Create Folder": {
                name: "Create Folder"
            },
            "Create ECR": {
                name: "Create ECR"
            },
            "Add/Remove Points": {
                name: "Add/Remove Points"
            },
            "Rename": {
                name: "Rename"
            },
            "Set Sub Status": {
                name: "Set Sub Status"
            },
            "Open": {
                name: "Open"
            },
            "Open in New window": {
                name: "Open in New window"
            },
            "Quick Info": {
                name: "Quick Info"
            }
        }
    });

    $('.projects-dropdown').on('click', function(e) {
        console.log('clicked', this);
    })
});

我想从上面的功能中删除项目&直接调用如下

<div class="dropdown projects-dropdown"> 
    <i class="fa fa-file-text" data-toggle="context" data-target="#context-menu"></i>
    </a>
    <div id="context-menu">
        <ul class="dropdown-menu">
            <li><a href="#">Edit Priority</a></li>
            <li><a href="#">Set Sub Status</a></li>
            <li><a href="#">Open in New Tab</a></li>
            <li><a href="#">Open in New Window</a></li>
            <li><a href="#">Quick Info</a></li>
        </ul>
    </div>
</div>

0 个答案:

没有答案