Своё контекстное меню на вашем сайте через плагин Proto Menu на Javascript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
<link rel="stylesheet" href="/css/proto.menu.css" type="text/css" media="screen" /> <script type="text/javascript" src="/js/prototype.js"></script> <script type="text/javascript" src="/js/effects.js"></script> <script type="text/javascript" src="/js/proto.menu.js"></script> <script type="text/javascript"> Element.addMethods({ getNumStyle: function(element, style) { var value = $(element).getStyle(style); return value === null ? null : parseInt(value); } }); document.observe('dom:loaded', function(){ var myMenuItems = [ { name: 'New', className: 'new', callback: function(e) { var tagName = e.element().tagName.toLowerCase(), x = e.screenX, y = e.screenY; alert('you clicked on <' + tagName + '> element at x: ' + x + ', and y: ' + y); } },{ separator: true },{ name: 'Edit', className: 'edit', callback: function() { alert('Forward function called'); } },{ name: 'Copy', className: 'copy', callback: function() { alert('Copy function called'); } },{ name: 'Delete', disabled: true, className: 'delete' },{ separator: true },{ name: 'Save', className: 'save', callback: function() { alert('Saving...'); } },{ separator: true },{ name: 'Save as .xsl', className: 'xsl', callback: function() { alert('Saving as .xsl'); } },{ name: 'Save as .doc', className: 'doc', callback: function() { alert('Saving as .doc'); } },{ name: 'Save as .pdf', className: 'pdf', callback: function() { alert('Saving as .pdf'); } },{ separator: true },{ name: 'Send to...', disabled: true, className: 'send' } ] new Proto.Menu({ selector: '#desc', className: 'menu desktop', menuItems: myMenuItems }) }); </script> |
2#: Контент, в котором правый клик будет заменяться на ваше меню, обрамляется так:
1 2 3 |
<div id='desc'> Ваш контент </div> |