任意位置生成右键自定义菜单插件context.js之API与调用
2016-11-29 17:03
549 查看
jQuery轻量级右键菜单插件context.js,支持Bootstrap,可以选择使用或不使用Bootstrap,支持递归子菜单以及
横线间隔菜单,支持动态添加/删除菜单,支持菜单链接,样子还不错,推荐使用。
使用方法:
1.加载插件和jQuery
2.初始化
view
source
print?
横线间隔菜单,支持动态添加/删除菜单,支持菜单链接,样子还不错,推荐使用。
使用方法:
1.加载插件和jQuery
1 | <script src= "js/jquery.min.js" ></script> |
2 | <script src= "js/context.js" ></script> |
3 | <link rel= "stylesheet" type= "text/css" href= "css/context.standalone.css" > |
view
source
print?
01 | <script> |
02 | $(document).ready( function (){ |
03 | context.init({preventDoubleContext: false }); |
04 | context.settings({compress: true }); |
05 | context.attach( 'html' , [//attach为绑定的dom对象,可以使用类名或id,例如'.classname' |
06 | {header: 'Compressed Menu' }, |
07 | {text: 'Back' , href: '#' }, |
08 | {text: 'Reload' , href: '#' }, |
09 | {divider: true }, |
10 | {text: 'Save As' , href: '#' }, |
11 | {text: 'Print' , href: '#' }, |
12 | {text: 'View Page Source' , href: '#' }, |
13 | {text: 'View Page Info' , href: '#' }, |
14 | {divider: true }, |
15 | {text: 'Inspect Element' , href: '#' }, |
16 | {divider: true }, |
17 | {text: 'Disable This Menu' , action: function (e){ |
18 | e.preventDefault(); |
19 | context.destroy( 'html' ); |
20 | alert( 'html contextual menu destroyed!' ); |
21 | }}, |
22 | {text: 'Donate?' , action: function (e){ |
23 | e.preventDefault(); |
24 | $( '#donate' ).submit(); |
25 | }} |
26 | ]); |
27 | }); |
28 | </script> |
相关文章推荐
- javascriptAPI 地图窗口任意位置右键显示菜单功能
- Revit API进阶之调用Revit命令、外部命令、其他插件按钮、右键菜单命令...
- visual studio 插件开发(5) -- 在任意位置添加自己的菜单
- js实现自定义右键菜单--兼容IE、Firefox、Chrome
- JS实现的自定义右键菜单实例二则
- js实现完全自定义可带多级目录的网页鼠标右键菜单方法
- eclipse3.7插件构建自定义右键菜单
- js实现鼠标右键自定义菜单(弹出层),并与树形菜单(TreeView)、iframe合用(兼容IE、Firefox、Chrome)
- Java实现HMacMD5加密,用于淘宝客JS 组件 API 调用时生成 sign 的签名
- JS 右键自定义菜单
- JS实现的自定义右键菜单实例二则
- 对任意元素,自定义右键菜单
- Ferris教程学习笔记:js示例5.7 自定义右键菜单,请在页面点击右键查看效果。
- JavaScript 对任意元素,自定义右键菜单的实现方法
- js禁止默认的右键菜单或出现自定义右键菜单
- 对任意元素,自定义右键菜单
- JSP----jQuery插件ContextMenu生成右键菜单
- YbSoftwareFactory 代码生成插件【十一】:ASP.NET WebApi MVC下组织机构管理和菜单权限管理的实现
- js实现完全自定义可带多级目录的网页鼠标右键菜单方法
- chrome插件演示,通过js调用chrome api清除浏览器缓存