vhost-audit/contrib/contextmenu/documentation/demo/accesskeys_test.md

42 lines
1.5 KiB
Markdown
Raw Normal View History

2021-03-16 20:50:02 -07:00
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Demo: Accesskeys](#demo-accesskeys)
- [Example code](#example-code)
- [Example HTML](#example-html)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
# Demo: Accesskeys
<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 message = "clicked: " + key;
$('#msg').text(message);
},
items: {
"edit": {name: "Edit", icon: "edit", accesskey: "e"},
"cut": {name: "Cut", icon: "cut", accesskey: "c"},
// first unused character is taken (here: o)
"copy": {name: "Copy", icon: "copy", accesskey: "c o p y"},
// words are truncated to their first letter (here: p)
"paste": {name: "Paste", icon: "paste", accesskey: "cool paste"},
"delete": {name: "Delete", icon: "delete"},
"sep1": "---------",
"quit": {name: "Quit", icon: function($element, key, item){ return 'context-menu-icon context-menu-icon-quit'; }}
}
});
});
</script>
## Example HTML
<div style="display:none;" class="showcase" data-showcase-import=".context-menu-one"></div>
<div id="msg"></div>