A simple and customizable context menu plugin for jQuery.
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<script src="simple-context-menu.min.js"></script>
let options = [
{
label: 'Copy',
icon: '<i class="fa fa-copy"></i>',
action: () => console.log('Copy selected')
},
...,
...,
...
];
$(selector).simpleContextMenu({
options: options
});
option | default | description |
---|---|---|
class | null | You can set custom css class to context menu container |
onShow | null | set an callback function, which will trigger after context menu shown |
onHide | null | set an callback function, which will trigger after context menu hide |
options | [] | set an array of object. Each object possible option label ( string ), action ( function ) and icon ( string ) |
For icon you can set font awesome or anything
icon: '<i class="fa fa-copy"></i>'
or
icon: '<img src="images/copy-icon.png">'