JSFiddle - React, Tailwind, and code Playground
by rodneyrehm
HTML
<link rel="stylesheet" href="http://medialize.github.com/jQuery-contextMenu/src/jquery.contextMenu.css">
<script src="http://medialize.github.com/jQuery-contextMenu/src/jquery.ui.position.js"></script>
<script src="http://test.dev/jquery/contextMenu/src/jquery.contextMenu.js"></script>
<div class="context-menu-one box menu-1">
<strong>right click me</strong>
</div>
CSS
/* demo trigger boxes */
.box {
color: #EEE;
background: #666;
font-weight: bold;
padding: 20px;
text-align: center;
font-size: 20px;
margin: 5px 0;
}
.box:hover {
background: #777;
}
.box > * {
display:block;
}
.menu-injected { background-color: #C87958; }
.box.context-menu-disabled { background-color: red; }
JavaScript
$(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"},
"aForm": {
name: "New Entry",
items: {
"newTitle": {name: "Title", type: "text"}
}
}
}
});
})