实用的Context.js 右键菜单
来源:互联网 发布:软件定制开发流程 编辑:程序博客网 时间:2024/05/29 10:57
ContextJS is a lightweight solution for contextual menus. Currently, there are two versions.
The first is to be used with Twitters Bootstrap (bootstrap.css specifically). If you do not use or want to use bootstrap.css, there is a standalone stylesheet to give the menu it's base styles.
Features
- Linted: Valid JS
- Can be used with or without Twitters Bootstrap.css
- Event Based Links
- Anchor Links
- Headers
- Dividers
- Recursive Menus (infinite depth)
- Vertical Space Detection (turns into a "dropup")
- Horizontal Space Detection (Drops to the left instead of right)
- Add/Delete menus Dynamically
在线实例
实例演示
使用方法
- context.init({
- fadeSpeed: 100,
- filter: function ($obj){},
- above: 'auto',
- preventDoubleContext: true,
- compress: false
- });
复制
Headers
- {
- header: 'My Header Title'
- }
复制
Anchor Links
- {
- text: 'My Link Title',
- href: 'http://contextjs.com/',
- target: '_blank'
- }
复制
Dividers
- {
- divider: true
- }
复制
Event Based Actions
- {
- text: 'Event Based Link',
- action: function(e){
- e.preventDefault();
- alert('Do Something');
- }
- }
复制
Sub-Menus
- {
- text: 'My Sub-menu',
- subMenu: [menuObjects]
- }
复制
Tracking Links with Google Analytics
- {
- text: 'context.js',
- href: 'http://contextjs.com/context.js',
- target:'_blank',
- action: function(e){
- _gaq.push(['_trackEvent', 'ContextJS Download', this.pathname, this.innerHTML]);
- }
- }
复制
参数详解
Paramater Type Default DescriptionfadeSpeedint100The speed in which the context menu fades in (in milliseconds)filterfunctionnullFunction that each finished list element will pass through for extra modification.abovestring || boolean'auto'If set to 'auto', menu will appear as a "dropup" if there is not enough room below it. Settings to true will make the menu a "popup" by default.preventDoubleContextbooleantrueIf set to true, browser-based context menus will not work on contextjs menus.compressbooleanfalseIf set to true, context menus will have less padding, making them (hopefully) more unobtrusive
Updating Settings
- context.settings({initSettings});
复制
Paramater Type Default DescriptionsettingsobjectnullThe init settings can be placed in here to update context menus written to the DOM. Changing settings between attaching menus will give the menus their own options.
Attaching
- context.attach('#download', [menuObjects]);
复制
Paramater Type Default DescriptionselectorstringnullThe jQuery (or css) selector of the element you want to apply the context menu tomenuObjectsarraynullAn array of objects that define the menus structure
Destroying
- context.destroy('#download');
复制
Paramater Type Default DescriptionselectorstringnullThe jQuery (or css) selector of the element you want to remove the context menu from
引用 http://zaixianshouce.iteye.com/blog/2325808
0 0
- 实用的Context.js 右键菜单
- Js+DVML:很酷实用的右键弹出菜单
- JS伸缩的菜单 + 右键菜单
- Buzzword样式的右键菜单 Customized Context Menu as Buzzword
- 一个右键菜单的JS类
- 非常简洁高效的JS右键菜单
- 非常简洁高效的JS右键菜单
- js订制自己的右键菜单
- 屏蔽右键菜单查看源代码的JS
- js实现右键菜单的一个实例
- js阻止默认右键的下拉菜单
- 为ubuntu添加几个实用的右键菜单
- 右键菜单----js代码
- 多级右键菜单 JS
- JS屏蔽右键菜单
- JS右键菜单
- JS 右键菜单功能
- JS 右键菜单功能
- Android查找SD卡中所需的文件
- 两次救场、两度弃子:被嫌弃的盛大游戏的一生
- html中的混合布局居中
- shell小记
- PageRank算法的简单实现.
- 实用的Context.js 右键菜单
- 创建线程的方式
- 基于Jenkins 实现php项目的自动化测试、自动打包和自动部署
- 给Python初学者:如何用Django写一个36Kr
- 邮箱软件配置
- 前端性能优化----yahoo前端性能团队总结的35条黄金定律
- Java调用bat批处理文件动态传参问题
- 浏览器探究 - HTML5规范之Application Cache(1)
- iOS手机摄像头测心率