Proto.MenuPrototype菜单插件
Proto.Menu 是一个基于 Prototype 开发的菜单组件。如下图所示:
示例代码:
var myLinks = [
{name: 'Back', callback: function(){alert('back function called')}},
{name: 'Forward', callback: function(){alert('Forward function called')}},
{separator: true},
{name: 'Reload', callback: function(){alert('Reload function called')}},
{name: 'Disabled option', disabled: true},
{name: 'Toggle previous option', callback: function(){
var item = oLinks.find(function(l){return l.name == 'Disabled option'});
item.disabled = item.disabled == false ? true : false;
}}
]
<script type="text/javascript">
new Proto.Menu({
selector: '.contextmenu' // context menu will be shown when element with class name of "contextmenu" is clicked
className: 'myContextMenu', // this is a class which will be attached to menu container (used for css styling)
menuItems: myLinks // array of menu items
})
</script>