vhost-audit/contrib/contextmenu/documentation/demo/keeping-contextmenu-open.md

45 lines
1.2 KiB
Markdown

---
currentMenu: keeping-contextmenu-open
---
# Demo: Keeping the Menu visible
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Example code](#example-code)
- [Example HTML](#example-html)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<span class="context-menu-one btn btn-neutral">right click me</span>
## Example code
<script type="text/javascript" class="showcase">
$(function(){
$.contextMenu({
selector: '.context-menu-one',
callback: function(key, options) {
var m = "clicked: " + key;
window.console && console.log(m) || alert(m);
},
items: {
"edit": {
name: "Closing on Click",
icon: "edit",
callback: function(){ return true; }
},
"cut": {
name: "Open after Click",
icon: "cut",
callback: function(){ return false; }
}
}
});
});
</script>
## Example HTML
<div style="display:none;" class="showcase" data-showcase-import=".context-menu-one"></div>