Proto.MenuPrototype菜单插件

联合创作 · 2023-09-28 08:59

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>

浏览 8
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑 分享
举报