1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
\r
3 <html xmlns="http://www.w3.org/1999/xhtml">
\r
6 <title>jQuery Context Menu Plugin Demo</title>
\r
7 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
\r
9 <style type="text/css">
\r
16 font-family: Verdana, Arial, Helvetica, sans-serif;
\r
23 font-family: Georgia, serif;
\r
25 font-weight: normal;
\r
29 font-family: Georgia, serif;
\r
31 font-weight: normal;
\r
32 margin: 0px 0px 10px 0px;
\r
37 border: solid 1px #2AA7DE;
\r
38 background: #6CC8EF;
\r
57 border: solid 1px #2AA7DE;
\r
58 background: #6CC8EF;
\r
69 font-family: Verdana, Arial, Helvetica, sans-serif;
\r
76 <script src="../js/lib/jquery-1.4.2.min.js" type="text/javascript"></script>
\r
77 <script src="jquery.contextMenu.js" type="text/javascript"></script>
\r
78 <link href="jquery.contextMenu.css" rel="stylesheet" type="text/css" />
\r
80 <script type="text/javascript">
\r
82 $(document).ready( function() {
\r
84 // Show menu when #myDiv is clicked
\r
85 $("#myDiv").contextMenu({
\r
88 function(action, el, pos) {
\r
90 'Action: ' + action + '\n\n' +
\r
91 'Element ID: ' + $(el).attr('id') + '\n\n' +
\r
92 'X: ' + pos.x + ' Y: ' + pos.y + ' (relative to element)\n\n' +
\r
93 'X: ' + pos.docX + ' Y: ' + pos.docY+ ' (relative to document)'
\r
97 // Show menu when a list item is clicked
\r
98 $("#myList UL LI").contextMenu({
\r
100 }, function(action, el, pos) {
\r
102 'Action: ' + action + '\n\n' +
\r
103 'Element text: ' + $(el).text() + '\n\n' +
\r
104 'X: ' + pos.x + ' Y: ' + pos.y + ' (relative to element)\n\n' +
\r
105 'X: ' + pos.docX + ' Y: ' + pos.docY+ ' (relative to document)'
\r
110 $("#disableMenus").click( function() {
\r
111 $('#myDiv, #myList UL LI').disableContextMenu();
\r
112 $(this).attr('disabled', true);
\r
113 $("#enableMenus").attr('disabled', false);
\r
117 $("#enableMenus").click( function() {
\r
118 $('#myDiv, #myList UL LI').enableContextMenu();
\r
119 $(this).attr('disabled', true);
\r
120 $("#disableMenus").attr('disabled', false);
\r
123 // Disable cut/copy
\r
124 $("#disableItems").click( function() {
\r
125 $('#myMenu').disableContextMenuItems('#cut,#copy');
\r
126 $(this).attr('disabled', true);
\r
127 $("#enableItems").attr('disabled', false);
\r
131 $("#enableItems").click( function() {
\r
132 $('#myMenu').enableContextMenuItems('#cut,#copy');
\r
133 $(this).attr('disabled', true);
\r
134 $("#disableItems").attr('disabled', false);
\r
144 <h1>jQuery Context Menu Plugin Demo</h1>
\r
146 This plugin lets you add context menu functionality to your web applications.
\r
150 <strong>Tip:</strong> Try using your keyboard to make a selection.
\r
154 <a href="http://abeautifulsite.net/2008/09/jquery-context-menu-plugin/">Back to the project page</a>
\r
160 Right click to view the context menu
\r
176 <input type="button" id="disableItems" value="Disable Cut/Copy" />
\r
177 <input type="button" id="enableItems" value="Enable Cut/Copy" disabled="disabled" />
\r
181 <input type="button" id="disableMenus" value="Disable Context Menus" />
\r
182 <input type="button" id="enableMenus" value="Enable Context Menus" disabled="disabled" />
\r
186 <ul id="myMenu" class="contextMenu">
\r
187 <li class="edit"><a href="#edit">Edit</a></li>
\r
188 <li class="cut separator"><a href="#cut">Cut</a>
\r
190 <li class="pe"><a href="#pe">Pe</a></li>
\r
193 <li class="copy"><a href="#copy">Copy</a></li>
\r
194 <li class="paste"><a href="#paste">Paste</a></li>
\r
195 <li class="delete"><a href="#delete">Delete</a></li>
\r
196 <li class="quit separator"><a href="#quit">Quit</a></li>
\r